Class: Earch

Inherits:
Twing::Modules::Base
  • Object
show all
Defined in:
lib/twing_earch/earch.rb,
lib/twing_earch/rules.rb

Defined Under Namespace

Classes: Notify, Rule, Rules

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Earch

Returns a new instance of Earch.



9
10
11
12
13
# File 'lib/twing_earch/earch.rb', line 9

def initialize(*args)
  super
  @notify = Notify.new(setting.slack)
  @rules = Rules.new(setting.rules || {})
end

Instance Attribute Details

#notifyObject (readonly)

Returns the value of attribute notify.



7
8
9
# File 'lib/twing_earch/earch.rb', line 7

def notify
  @notify
end

#rulesObject (readonly)

Returns the value of attribute rules.



7
8
9
# File 'lib/twing_earch/earch.rb', line 7

def rules
  @rules
end

Instance Method Details

#on_message(object) ⇒ Object



15
16
17
18
19
20
21
# 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