Class: Multiflow::Machine

Inherits:
Object
  • Object
show all
Defined in:
lib/multiflow/machine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&machine) ⇒ Machine

Returns a new instance of Machine.



5
6
7
8
# File 'lib/multiflow/machine.rb', line 5

def initialize(&machine)
  @states, @events, @create_scopes = Hash.new, Hash.new, true
  instance_eval(&machine)
end

Instance Attribute Details

#eventsObject

Returns the value of attribute events.



3
4
5
# File 'lib/multiflow/machine.rb', line 3

def events
  @events
end

#initial_stateObject

Returns the value of attribute initial_state.



3
4
5
# File 'lib/multiflow/machine.rb', line 3

def initial_state
  @initial_state
end

#statesObject

Returns the value of attribute states.



3
4
5
# File 'lib/multiflow/machine.rb', line 3

def states
  @states
end

Instance Method Details

#create_scopes(bool = false) ⇒ Object



14
15
16
# File 'lib/multiflow/machine.rb', line 14

def create_scopes(bool = false)
  @create_scopes = bool
end

#create_scopes?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/multiflow/machine.rb', line 18

def create_scopes?
  @create_scopes
end

#state_column(name = :state) ⇒ Object



10
11
12
# File 'lib/multiflow/machine.rb', line 10

def state_column(name = :state)
  @state_column ||= name
end