class DBWrapper::ListenersController

Public Class Methods

new(listeners) click to toggle source
# File lib/db_wrapper/listeners_controller.rb, line 4
def initialize(listeners)
  @listeners = listeners
end

Public Instance Methods

call_listeners(protocol, raw_command) click to toggle source
# File lib/db_wrapper/listeners_controller.rb, line 8
def call_listeners(protocol, raw_command)
  return if @listeners.nil?
  parsed_command = protocol.parse_command raw_command
  return if parsed_command.empty?
  @listeners.select { |listener| listener.listening?(parsed_command) }.each do |listener|
    listener.command = parsed_command
    listener.perform
  end
end