class Voltron::Defender::Commander

Public Class Methods

new() click to toggle source
# File lib/voltron/defender/commander.rb, line 5
def initialize
  @listeners = []
end

Public Instance Methods

listen_to(klass) click to toggle source
# File lib/voltron/defender/commander.rb, line 23
def listen_to(klass)
  @listeners << klass.new
end
listeners() click to toggle source
# File lib/voltron/defender/commander.rb, line 19
def listeners
  @listeners || []
end
matches?(text) click to toggle source
# File lib/voltron/defender/commander.rb, line 9
def matches?(text)
  processor(text).present?
end
processor(text) click to toggle source
# File lib/voltron/defender/commander.rb, line 13
def processor(text)
  @listeners.find do |listener|
    listener.matches?(text)
  end
end