module SlackRespondent::Reactions

Public Class Methods

included(base) click to toggle source
# File lib/slack_respondent/reactions.rb, line 3
def self.included(base)
  base.cattr_accessor :reactions
end

Public Instance Methods

config() click to toggle source
# File lib/slack_respondent/reactions.rb, line 27
def config
  SlackRespondent.config
end
on(event_name, command) click to toggle source
# File lib/slack_respondent/reactions.rb, line 7
def on(event_name, command)
  self.reactions ||= {}

  self.reactions[event_name] ||= []
  self.reactions[event_name].insert(0, command)
end
react(event_type, data) click to toggle source
# File lib/slack_respondent/reactions.rb, line 14
def react(event_type, data)

  result = false
  reactions[event_type].each do |reaction|
    if reaction.invoke(client, data.event)
      result = true
      break
    end
  end

  result
end

Private Instance Methods

client() click to toggle source
# File lib/slack_respondent/reactions.rb, line 33
def client
  @client ||= SlackRespondent::ClientWrapper.new
end