Class: Andromeda::Kit::Reducer

Inherits:
Gatherer show all
Defined in:
lib/andromeda/kit.rb

Instance Attribute Summary collapse

Attributes included from Transf

#filter, #mapper

Attributes inherited from Plan

#error_level, #log, #marker, #nick, #trace_enter, #trace_exit

Attributes inherited from Impl::ProtoPlan

#guide, #id

Instance Method Summary collapse

Methods included from Transf

#deliver_data

Methods inherited from SinglePlan

#init_guide

Methods inherited from Plan

#initialize, #initialize_copy, #pool, #tap, #to_short_s

Methods inherited from Impl::ProtoPlan

#>>, #current_name, #current_scope, #data_key, #data_tag, #data_val, #dest, #entry, #init_guide, #initialize, #initialize_copy, #key_label, #key_spot, #map_data, #mute, name_spot, #post_data, #post_to, #public_spot, #selects?, #signal_name?, signal_names, #signal_names, signal_spot, spot_attr, #spot_attr_name?, spot_attr_names, #spot_attr_names, spot_meth, #spot_meth_name?, spot_meth_names, #spot_meth_names, #spot_name?, spot_names, #spot_names, #tags, #to_short_s, #via

Methods included from Impl::To_S

short_s, #to_s, #to_short_s

Methods inherited from Impl::ConnectorBase

#post, #post_local, #start

Constructor Details

This class inherits a constructor from Andromeda::Plan

Instance Attribute Details

#reducerObject

Returns the value of attribute reducer.



116
117
118
# File 'lib/andromeda/kit.rb', line 116

def reducer
  @reducer
end

#stateObject

Returns the value of attribute state.



115
116
117
# File 'lib/andromeda/kit.rb', line 115

def state
  @state
end

Instance Method Details

#on_enter(key, val) ⇒ Object



120
121
122
123
124
125
126
127
128
129
# File 'lib/andromeda/kit.rb', line 120

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