Class: Workflow::Event::Transition

Inherits:
Object
  • Object
show all
Defined in:
lib/workflow/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target_state, conditions_def, &block) ⇒ Transition

delegate :apply?, to: :conditions



36
37
38
39
# File 'lib/workflow/event.rb', line 36

def initialize(target_state, conditions_def, &block)
  @target_state = target_state
  @conditions = Conditions.new conditions_def, &block
end

Instance Attribute Details

#conditionsObject

Returns the value of attribute conditions.



31
32
33
# File 'lib/workflow/event.rb', line 31

def conditions
  @conditions
end

#target_stateObject

Returns the value of attribute target_state.



31
32
33
# File 'lib/workflow/event.rb', line 31

def target_state
  @target_state
end

Instance Method Details

#apply?(target) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/workflow/event.rb', line 32

def apply?(target)
  conditions.apply?(target)
end

#inspectObject



41
42
43
# File 'lib/workflow/event.rb', line 41

def inspect
  "<to=#{target_state.inspect} conditions=#{conditions.inspect}"
end