ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:92623] [Ruby trunk Feature#15842] Allow DelegateClass() to module_eval given block
       [not found] <redmine.issue-15842.20190511234038@ruby-lang.org>
@ 2019-05-11 23:40 ` merch-redmine
  2019-05-24  0:52 ` [ruby-core:92810] " merch-redmine
  1 sibling, 0 replies; 2+ messages in thread
From: merch-redmine @ 2019-05-11 23:40 UTC (permalink / raw)
  To: ruby-core

Issue #15842 has been reported by jeremyevans0 (Jeremy Evans).

----------------------------------------
Feature #15842: Allow DelegateClass() to module_eval given block
https://bugs.ruby-lang.org/issues/15842

* Author: jeremyevans0 (Jeremy Evans)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Methods that return classes often module_eval the given block
(e.g. `Class.new` and `Struct.new`).  This allows `DelegateClass` to
work similarly.  This makes it easier to use `DelegateClass`
directly without subclassing, so as not to create an unnecessary
intermediate class. Example:

```ruby
MyClass = DelegateClass(ClassToDelegateTo) do
  def initialize
    super(obj_of_ClassToDelegateTo)
  end
end
```

Attached is a patch that implements this proposal.

---Files--------------------------------
delegate-class-block.patch (2.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ruby-core:92810] [Ruby trunk Feature#15842] Allow DelegateClass() to module_eval given block
       [not found] <redmine.issue-15842.20190511234038@ruby-lang.org>
  2019-05-11 23:40 ` [ruby-core:92623] [Ruby trunk Feature#15842] Allow DelegateClass() to module_eval given block merch-redmine
@ 2019-05-24  0:52 ` merch-redmine
  1 sibling, 0 replies; 2+ messages in thread
From: merch-redmine @ 2019-05-24  0:52 UTC (permalink / raw)
  To: ruby-core

Issue #15842 has been updated by jeremyevans0 (Jeremy Evans).


As delegate.rb is unmaintained, unless someone objects in the next week, I plan on committing this feature.

----------------------------------------
Feature #15842: Allow DelegateClass() to module_eval given block
https://bugs.ruby-lang.org/issues/15842#change-78182

* Author: jeremyevans0 (Jeremy Evans)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Methods that return classes often module_eval the given block
(e.g. `Class.new` and `Struct.new`).  This allows `DelegateClass` to
work similarly.  This makes it easier to use `DelegateClass`
directly without subclassing, so as not to create an unnecessary
intermediate class. Example:

```ruby
MyClass = DelegateClass(ClassToDelegateTo) do
  def initialize
    super(obj_of_ClassToDelegateTo)
  end
end
```

Attached is a patch that implements this proposal.

---Files--------------------------------
delegate-class-block.patch (2.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-24  0:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-15842.20190511234038@ruby-lang.org>
2019-05-11 23:40 ` [ruby-core:92623] [Ruby trunk Feature#15842] Allow DelegateClass() to module_eval given block merch-redmine
2019-05-24  0:52 ` [ruby-core:92810] " merch-redmine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).