module Moory::Efferent

Attributes

repertoire[RW]

Private Instance Methods

guarded_call(receiver, output) click to toggle source
# File lib/moory/machine.rb, line 77
def guarded_call(receiver, output)
  output ? receiver.call(output) : receiver.call
end
honour(response) click to toggle source
Calls superclass method Moory::Afferent#honour
# File lib/moory/machine.rb, line 56
def honour(response)
  super
  perform(response) if repertoire
end
perform(response) click to toggle source
# File lib/moory/machine.rb, line 61
def perform(response)
  perform_always(response[:output])
  perform_special(response)
end
perform_always(output) click to toggle source
# File lib/moory/machine.rb, line 66
def perform_always(output)
  guarded_call(always, output)
end
perform_special(response) click to toggle source
# File lib/moory/machine.rb, line 70
def perform_special(response)
  guarded_call(
    repertoire.recall(response[:effector]),
    response[:output]
  ) if response[:effector]
end