class NxtStateMachine::DefuseRegistry

Public Instance Methods

register(from, to, kind) click to toggle source
# File lib/nxt_state_machine/defuse_registry.rb, line 5
def register(from, to, kind)
  Array(from).each do |from_state|
    Array(to).each do |to_state|
      defusing_errors = errors.from(from_state).to(to_state)
      Array(kind).each_with_object(defusing_errors) { |error, acc| acc << error }
    end
  end
end
resolve!(transition) click to toggle source
# File lib/nxt_state_machine/defuse_registry.rb, line 14
def resolve!(transition)
  errors.from!(transition.from.enum).to!(transition.to.enum)
end

Private Instance Methods

errors() click to toggle source
# File lib/nxt_state_machine/defuse_registry.rb, line 20
def errors
  @errors ||= registry :from do
    level :to, default: -> { [] }
  end
end