Class: NxtStateMachine::DefuseRegistry

Inherits:
Object
  • Object
show all
Includes:
NxtRegistry
Defined in:
lib/nxt_state_machine/defuse_registry.rb

Instance Method Summary collapse

Instance Method Details

#register(from, to, kind) ⇒ Object



5
6
7
8
9
10
11
12
# 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) ⇒ Object



14
15
16
# File 'lib/nxt_state_machine/defuse_registry.rb', line 14

def resolve!(transition)
  errors.from!(transition.from.enum).to!(transition.to.enum)
end