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/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>