Class: Statemachine::Superstate

Inherits:
State
  • Object
show all
Defined in:
lib/statemachine/superstate.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Attributes inherited from State

#default_transition, #entry_action, #exit_action, #id, #statemachine, #superstate

Instance Method Summary collapse

Methods inherited from State

#activate, #add, #enter, #exit, #non_default_transition_for, #transition_for, #transitions

Constructor Details

#initialize(id, superstate, statemachine) ⇒ Superstate



8
9
10
11
12
13
# File 'lib/statemachine/superstate.rb', line 8

def initialize(id, superstate, statemachine)
  super(id, superstate, statemachine)
  @startstate = nil
  @history_id = nil
  @default_history_id = nil
end

Instance Attribute Details

#history_idObject (readonly)

Returns the value of attribute history_id.



6
7
8
# File 'lib/statemachine/superstate.rb', line 6

def history_id
  @history_id
end

#startstate_idObject

Returns the value of attribute startstate_id.



5
6
7
# File 'lib/statemachine/superstate.rb', line 5

def startstate_id
  @startstate_id
end

Instance Method Details

#add_substates(*substate_ids) ⇒ Object



31
32
33
# File 'lib/statemachine/superstate.rb', line 31

def add_substates(*substate_ids)
  do_substate_adding(substate_ids)
end

#concrete?Boolean



15
16
17
# File 'lib/statemachine/superstate.rb', line 15

def concrete?
  return false
end

#default_history=(state_id) ⇒ Object



35
36
37
# File 'lib/statemachine/superstate.rb', line 35

def default_history=(state_id)
  @history_id = @default_history_id = state_id
end

#resetObject



39
40
41
# File 'lib/statemachine/superstate.rb', line 39

def reset
  @history_id = @default_history_id
end

#resolve_startstateObject



23
24
25
# File 'lib/statemachine/superstate.rb', line 23

def resolve_startstate
  return startstate.resolve_startstate
end

#startstateObject



19
20
21
# File 'lib/statemachine/superstate.rb', line 19

def startstate
  return @statemachine.get_state(@startstate_id)
end

#substate_exiting(substate) ⇒ Object



27
28
29
# File 'lib/statemachine/superstate.rb', line 27

def substate_exiting(substate)
  @history_id = substate.id
end

#to_sObject



43
44
45
# File 'lib/statemachine/superstate.rb', line 43

def to_s
  return "'#{id}' superstate"
end