Class: RMachine::ChangeStateValueNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/r_machine/notifiers/change_state_value_notifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ ChangeStateValueNotifier

Returns a new instance of ChangeStateValueNotifier.



5
6
7
8
# File 'lib/r_machine/notifiers/change_state_value_notifier.rb', line 5

def initialize(params)
  @state_template = params[:state_template]
  @new_value = params[:new_value]
end

Instance Attribute Details

#new_valueObject (readonly)

Returns the value of attribute new_value.



3
4
5
# File 'lib/r_machine/notifiers/change_state_value_notifier.rb', line 3

def new_value
  @new_value
end

#state_templateObject (readonly)

Returns the value of attribute state_template.



3
4
5
# File 'lib/r_machine/notifiers/change_state_value_notifier.rb', line 3

def state_template
  @state_template
end

Instance Method Details

#notify!Object



10
11
12
# File 'lib/r_machine/notifiers/change_state_value_notifier.rb', line 10

def notify!
  state_template.state = new_value
end