Module: Stateful::ClassMethods

Defined in:
lib/Stateful/ClassMethods.rb

Instance Method Summary collapse

Instance Method Details

#final_state(*state_names) ⇒ Object



27
28
29
# File 'lib/Stateful/ClassMethods.rb', line 27

def final_state(*state_names)
  stateful_states.final_state(*state_names)
end

#final_state?Boolean Also known as: has_final_state?

predicate methods

Returns:

  • (Boolean)


39
40
41
# File 'lib/Stateful/ClassMethods.rb', line 39

def final_state?
  !final_states.empty?
end

#final_states(*state_names) ⇒ Object



31
32
33
# File 'lib/Stateful/ClassMethods.rb', line 31

def final_states(*state_names)
  stateful_states.final_states(*state_names)
end

#initial_state(state_name = nil, options = {}, &block) ⇒ Object



19
20
21
# File 'lib/Stateful/ClassMethods.rb', line 19

def initial_state(state_name = nil, options = {}, &block)
  stateful_states.initial_state(state_name, options, &block)
end

#state(state_name, options = {}, &block) ⇒ Object



23
24
25
# File 'lib/Stateful/ClassMethods.rb', line 23

def state(state_name, options = {}, &block)
  stateful_states.state(state_name, options, &block)
end

#stateful(options = {}, &block) ⇒ Object

start DSL



15
16
17
# File 'lib/Stateful/ClassMethods.rb', line 15

def stateful(options = {}, &block)
  stateful_states.stateful(options, &block)
end

#stateful_statesObject



9
10
11
# File 'lib/Stateful/ClassMethods.rb', line 9

def stateful_states
  @stateful_states ||= Stateful::States.new(self)
end