class Orchestrated::OrchestrationDependency
Public Instance Methods
_constrain()
click to toggle source
# File lib/orchestrated/dependency.rb, line 35 def _constrain if prerequisite.present? # This method can be called more than once in general since it is called # as part of validation. Rather than loosening the state machine (to allow # e.g. complete=>complete) we explicitly avoid re-submitting events here. prerequisite_completed if prerequisite.complete? && can_prerequisite_completed? prerequisite_canceled if prerequisite.canceled? && can_prerequisite_canceled? end true end
call_dependent() { |dependent| ... }
click to toggle source
# File lib/orchestrated/dependency.rb, line 28 def call_dependent(&block) yield dependent unless dependent.nil? end
constrain()
click to toggle source
# File lib/orchestrated/dependency.rb, line 31 def constrain @saving = true _constrain.tap{@saving = false} end
save_avoiding_recursion()
click to toggle source
# File lib/orchestrated/dependency.rb, line 45 def save_avoiding_recursion # Default action of state_machine is "save", however that is # a problem when we need to transition state during validation # (see constrain method above). If were are validating then we # dursnt call save again. if @saving true # allow state transition but don't save ActiveRecord else save # save ActiveRecord as usual and return true/false end end