class BotBrain::Dictionary

Public Class Methods

new(commands, unknown_command = nil) click to toggle source
# File lib/bot_brain/dictionary.rb, line 3
def initialize(commands, unknown_command = nil)
  @commands = commands
  @unknown_command = unknown_command || Commands::UnknownCommand.new
end

Public Instance Methods

get_command(message) click to toggle source
# File lib/bot_brain/dictionary.rb, line 8
def get_command(message)
  command = @commands.detect { |c| c.can_answer?(message) }
  command || @unknown_command
end