Class: ChatworkTo::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/chatwork_to/notifier.rb

Instance Method Summary collapse

Constructor Details

#initialize(notifiers) ⇒ Notifier

Returns a new instance of Notifier.



7
8
9
10
11
12
13
# File 'lib/chatwork_to/notifier.rb', line 7

def initialize(notifiers)
  @notifiers = []
  notifiers.each do |notifier|
    name = notifier.delete('name')
    @notifiers << "ChatworkTo::Notifiers::#{name.classify}".constantize.new(notifier)
  end
end

Instance Method Details

#info(message) ⇒ Object



19
20
21
# File 'lib/chatwork_to/notifier.rb', line 19

def info(message)
  @notifiers.each { |n| n.info(message) }
end

#notify(hash) ⇒ Object



15
16
17
# File 'lib/chatwork_to/notifier.rb', line 15

def notify(hash)
  @notifiers.each { |n| n.notify(hash) }
end