class RMachine::StateTemplate

Attributes

events_by_name[R]
state_field_name[R]

Public Class Methods

new() click to toggle source
# File lib/r_machine/state_template.rb, line 5
def initialize
  @state_value = nil
  @events_by_name = {}
end

Public Instance Methods

field=(field_name) click to toggle source
# File lib/r_machine/state_template.rb, line 22
def field=(field_name)
  @state_field_name = field_name
end
find_event(name) click to toggle source
# File lib/r_machine/state_template.rb, line 14
def find_event(name)
  events_by_name[name]
end
initial=(initial_status) click to toggle source
# File lib/r_machine/state_template.rb, line 26
def initial=(initial_status)
  @state_value = initial_status
end
on(event_name) { |event| ... } click to toggle source
# File lib/r_machine/state_template.rb, line 30
def on(event_name)
  event = Event.new(event_name)
  events_by_name[event_name] = event
  yield event
end
state() click to toggle source
# File lib/r_machine/state_template.rb, line 10
def state
  @state_value
end
state=(v) click to toggle source
# File lib/r_machine/state_template.rb, line 18
def state=(v)
  @state_value = v
end