Class: Jrf::Stage::MapReducer
- Inherits:
-
Object
- Object
- Jrf::Stage::MapReducer
- Defined in:
- lib/jrf/stage.rb
Defined Under Namespace
Classes: SlotState
Instance Attribute Summary collapse
-
#slots ⇒ Object
readonly
Returns the value of attribute slots.
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize(type) ⇒ MapReducer
constructor
A new instance of MapReducer.
- #slot(key) ⇒ Object
Constructor Details
#initialize(type) ⇒ MapReducer
Returns a new instance of MapReducer.
198 199 200 201 |
# File 'lib/jrf/stage.rb', line 198 def initialize(type) @type = type @slots = {} end |
Instance Attribute Details
#slots ⇒ Object (readonly)
Returns the value of attribute slots.
196 197 198 |
# File 'lib/jrf/stage.rb', line 196 def slots @slots end |
Instance Method Details
#finish ⇒ Object
207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/jrf/stage.rb', line 207 def finish case @type when :array keys = @slots.keys.sort [keys.map { |k| Stage.resolve_template(@slots[k].template, @slots[k].reducers) }] when :hash result = {} @slots.each { |k, s| result[k] = Stage.resolve_template(s.template, s.reducers) } [result] end end |