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.
152 153 154 155 |
# File 'lib/jrf/stage.rb', line 152 def initialize(type) @type = type @slots = {} end |
Instance Attribute Details
#slots ⇒ Object (readonly)
Returns the value of attribute slots.
150 151 152 |
# File 'lib/jrf/stage.rb', line 150 def slots @slots end |
Instance Method Details
#finish ⇒ Object
161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/jrf/stage.rb', line 161 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 |