Class: RMachine::StateNotifierFactory

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ StateNotifierFactory



6
7
8
9
10
11
# File 'lib/r_machine/state_notifier_factory.rb', line 6

def initialize(params={})
  @object_called = params[:object_called]
  @state_template = params[:state_template]
  @message_name = params[:message_name]
  @message_args = params[:message_args]
end

Instance Attribute Details

#message_argsObject (readonly)

Returns the value of attribute message_args.



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

def message_args
  @message_args
end

#message_nameObject (readonly)

Returns the value of attribute message_name.



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

def message_name
  @message_name
end

#object_calledObject (readonly)

Returns the value of attribute object_called.



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

def object_called
  @object_called
end

#state_templateObject (readonly)

Returns the value of attribute state_template.



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

def state_template
  @state_template
end

Instance Method Details

#is_notifying_state_machine?Boolean



13
14
15
16
17
# File 'lib/r_machine/state_notifier_factory.rb', line 13

def is_notifying_state_machine?
  is_calling_state_attribute? ||
    is_changing_state_attribute? ||
    is_calling_an_event?
end

#notifierObject



19
20
21
22
23
24
25
26
27
# File 'lib/r_machine/state_notifier_factory.rb', line 19

def notifier
  if is_changing_state_attribute?
    build_change_state_value_notifier!
  elsif is_calling_state_attribute?
    build_retrieve_state_value_notifier!
  elsif is_calling_an_event?
    build_call_event_method_notifier!
  end
end