Class: Mapper::All
- Inherits:
-
Object
- Object
- Mapper::All
- Defined in:
- lib/mapper/all.rb
Overview
Reductor which simply returns array of results for all objects.
Instance Method Summary collapse
-
#initialize(objects) ⇒ All
constructor
Constructor.
-
#method_missing(name, *args, &block) ⇒ Object
Handles calls.
Constructor Details
#initialize(objects) ⇒ All
Constructor.
26 27 28 |
# File 'lib/mapper/all.rb', line 26 def initialize(objects) @objects = objects end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
Handles calls. (Performs mapping.)
34 35 36 |
# File 'lib/mapper/all.rb', line 34 def method_missing(name, *args, &block) result = @objects.map { |i| i.send(name, *args, &block) } end |