Class: Stateflow::Machine

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

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Machine) initialize(&machine)

A new instance of Machine



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

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

Instance Attribute Details

- (Object) events

Returns the value of attribute events



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

def events
  @events
end

- (Object) initial_state

Returns the value of attribute initial_state



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

def initial_state
  @initial_state
end

- (Object) states

Returns the value of attribute states



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

def states
  @states
end

Instance Method Details

- (Object) create_scopes(bool = false)



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

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

- (Boolean) create_scopes?

Returns:

  • (Boolean)


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

def create_scopes?
  @create_scopes
end

- (Object) state_column(name = :state)



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

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