class SlackBot::Command

Attributes

action[RW]
bot_client[RW]
help_message[RW]
regex[RW]

Public Class Methods

new(bot_client) click to toggle source
# File lib/simple_slack_bot/command.rb, line 5
def initialize(bot_client)
  @bot_client = bot_client
end

Public Instance Methods

execute(data) click to toggle source
# File lib/simple_slack_bot/command.rb, line 13
def execute(data)
  return if @action.nil?
  @action.call(data)
end
match?(str) click to toggle source
# File lib/simple_slack_bot/command.rb, line 9
def match?(str)
  (@regex.nil? || @regex.match(str).nil?) ? false : true
end