Class: SensuGenerator::Notifier

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

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Notifier

Returns a new instance of Notifier.



5
6
7
8
9
# File 'lib/sensu_generator/notifier.rb', line 5

def initialize(params = {})
  @notifier = if !params.any? { |k,v| v == "" || v.nil? }
                Slack::Notifier.new(params[:url], channel: params[:channel])
              end
end

Instance Method Details

#notify(msg) ⇒ Object



11
12
13
# File 'lib/sensu_generator/notifier.rb', line 11

def notify(msg)
  @notifier.ping msg.to_s if @notifier
end