Class: Enumerable::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/enumerable_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(method, enumerable) ⇒ Proxy

Returns a new instance of Proxy.



7
8
9
# File 'lib/enumerable_proxy.rb', line 7

def initialize(method, enumerable)
  @method, @enumerable = method, enumerable
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



11
12
13
# File 'lib/enumerable_proxy.rb', line 11

def method_missing(method, *args)
  @enumerable.send(@method) {|a| a.send method, *args}
end