Feature #15842
closedAllow DelegateClass() to module_eval given block
Description
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:
MyClass = DelegateClass(ClassToDelegateTo) do
def initialize
super(obj_of_ClassToDelegateTo)
end
end
Attached is a patch that implements this proposal.
Files
Updated by jeremyevans0 (Jeremy Evans) almost 5 years ago
As delegate.rb is unmaintained, unless someone objects in the next week, I plan on committing this feature.
Updated by jeremyevans (Jeremy Evans) almost 5 years ago
- Status changed from Open to Closed
Applied in changeset git|1cd93f1cdfbe6f7e71b05b3f8e707f21d70e94ba.
Allow DelegateClass() to module_eval given block
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
subclass.
Implements [Feature #15842]