Class: Enumerable::Proxy
- Inherits:
-
Object
- Object
- Enumerable::Proxy
- Defined in:
- lib/every.rb
Instance Method Summary collapse
-
#initialize(enum, method = :map) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(method, *args, &block) ⇒ Object
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 |