Class: Hecks::Bluebook::StateTransition

Inherits:
Object
  • Object
show all
Defined in:
lib/hecks/bluebook/lifecycle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target:, from: nil) ⇒ StateTransition

Returns a new instance of StateTransition.



8
9
10
11
12
13
14
15
# File 'lib/hecks/bluebook/lifecycle.rb', line 8

def initialize(target:, from: nil)
  @target = target.to_s
  @from   = case from
            when Array then from.map(&:to_s)
            when nil   then nil
            else            from.to_s
            end
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



6
7
8
# File 'lib/hecks/bluebook/lifecycle.rb', line 6

def from
  @from
end

#targetObject (readonly)

Returns the value of attribute target.



6
7
8
# File 'lib/hecks/bluebook/lifecycle.rb', line 6

def target
  @target
end

Instance Method Details

#constrained?Boolean

Returns:

  • (Boolean)


17
# File 'lib/hecks/bluebook/lifecycle.rb', line 17

def constrained? = !@from.nil?