Class: Andromeda::Kit::Reducer
- Inherits:
-
Gatherer
- Object
- Impl::ConnectorBase
- Impl::ProtoPlan
- Plan
- SinglePlan
- Gatherer
- Andromeda::Kit::Reducer
- Defined in:
- lib/andromeda/kit.rb
Instance Attribute Summary collapse
-
#reducer ⇒ Object
Returns the value of attribute reducer.
-
#state ⇒ Object
Returns the value of attribute state.
Attributes included from Transf
Attributes inherited from Plan
#error_level, #log, #marker, #nick, #trace_enter, #trace_exit
Attributes inherited from Impl::ProtoPlan
Instance Method Summary collapse
Methods included from Transf
Methods inherited from SinglePlan
Methods inherited from Plan
#initialize, #initialize_copy, #pool, #tap, #to_short_s
Methods inherited from Impl::ProtoPlan
#>>, attr_spot, #attr_spot_name?, attr_spot_names, #attr_spot_names, #current_name, #current_scope, #data_key, #data_map, #data_tag, #data_val, #dest, #entry, #init_guide, #initialize, #initialize_copy, #key_label, #key_spot, meth_spot, #meth_spot_name?, meth_spot_names, #meth_spot_names, #mute, name_spot, #post_data, #post_to, #public_spot, #selects?, #signal_name?, signal_names, #signal_names, signal_spot, #spot_name?, spot_names, #spot_names, #tags, #to_short_s, #via
Methods included from Impl::To_S
Methods inherited from Impl::ConnectorBase
Constructor Details
This class inherits a constructor from Andromeda::Plan
Instance Attribute Details
#reducer ⇒ Object
Returns the value of attribute reducer.
96 97 98 |
# File 'lib/andromeda/kit.rb', line 96 def reducer @reducer end |
#state ⇒ Object
Returns the value of attribute state.
95 96 97 |
# File 'lib/andromeda/kit.rb', line 95 def state @state end |
Instance Method Details
#on_enter(key, val) ⇒ Object
100 101 102 103 104 105 106 107 108 109 |
# File 'lib/andromeda/kit.rb', line 100 def on_enter(key, val) reducer_ = reducer state_ = state new_ = reducer_.call state_, key, val unless new_ == state_ state = new_ new_state << state if new_state end end |