Class: StrictMachine::TransitionDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/strict_machine/definition/transition_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definition) ⇒ TransitionDefinition

Returns a new instance of TransitionDefinition.



5
6
7
8
9
10
11
12
13
14
# File 'lib/strict_machine/definition/transition_definition.rb', line 5

def initialize(definition)
  definition.each_pair do |k, v|
    if k == :if
      @guard = v.to_sym
    else
      @name = k.to_sym
      @to = v.to_sym
    end
  end
end

Instance Attribute Details

#guardObject (readonly)

Returns the value of attribute guard.



3
4
5
# File 'lib/strict_machine/definition/transition_definition.rb', line 3

def guard
  @guard
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/strict_machine/definition/transition_definition.rb', line 3

def name
  @name
end

#toObject (readonly)

Returns the value of attribute to.



3
4
5
# File 'lib/strict_machine/definition/transition_definition.rb', line 3

def to
  @to
end

Instance Method Details

#guarded?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/strict_machine/definition/transition_definition.rb', line 16

def guarded?
  !@guard.nil?
end