class Earch

Attributes

notify[R]
rules[R]

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/twing_earch/earch.rb, line 9
def initialize(*args)
  super
  @notify = Notify.new(setting.slack)
  @rules = Rules.new(setting.rules || {})
end

Public Instance Methods

on_message(object) click to toggle source
# File lib/twing_earch/earch.rb, line 15
def on_message(object)
  case object
  when Twitter::Tweet
    logger.debug("Tweet #{object.id}")
    execute(object)
  end
end

Private Instance Methods

execute(object) click to toggle source
# File lib/twing_earch/earch.rb, line 25
def execute(object)
  notify.notify(object) if rules.match?(object)
end