class Ruboty::Handlers::Base

Attributes

robot[R]

Public Class Methods

actions() click to toggle source
# File lib/ruboty/handlers/base.rb, line 15
def actions
  []
end
inherited(child) click to toggle source
# File lib/ruboty/handlers/base.rb, line 7
def inherited(child)
  Ruboty.handlers << child
end
new(robot) click to toggle source
# File lib/ruboty/handlers/base.rb, line 25
def initialize(robot)
  @robot = robot
  validate!
end
on(pattern, options = {}) click to toggle source
# File lib/ruboty/handlers/base.rb, line 11
def on(pattern, options = {})
  actions << Action.new(pattern, options)
end

Public Instance Methods

call(message, options = {}) click to toggle source
# File lib/ruboty/handlers/base.rb, line 30
def call(message, options = {})
  self.class.actions.inject(false) do |matched, action|
    matched | action.call(self, message, options)
  end
end