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

Returns a new instance of Superstate.



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

def initialize(id, superstate, statemachine)
  super(id, superstate, statemachine)
  @startstate = nil
  @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



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

def add_substates(*substate_ids)
  do_substate_adding(substate_ids)
end

#concrete?Boolean

Returns:

  • (Boolean)


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

def concrete?
  return false
end

#default_history=(state_id) ⇒ Object



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

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

#resetObject



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

def reset
  @history_id = @default_history_id
end

#resolve_startstateObject



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

def resolve_startstate
  return startstate.resolve_startstate
end

#startstateObject



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

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

#substate_exiting(substate) ⇒ Object



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

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

#to_sObject



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

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