Class: Enumerable::Proxy

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

Instance Method Summary collapse

Constructor Details

#initialize(enum, method = :map) ⇒ Proxy

Returns a new instance of Proxy.



4
5
6
# File 'lib/every.rb', line 4

def initialize(enum, method=:map)
  @enum, @method = enum, method
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



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

def method_missing(method, *args, &block)
  @enum.__send__(@method) {|o| o.__send__(method, *args, &block) }
end