Class: SensuGenerator::Notifier
- Inherits:
-
Object
- Object
- SensuGenerator::Notifier
- Defined in:
- lib/sensu_generator/notifier.rb
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Notifier
constructor
A new instance of Notifier.
- #notify(msg) ⇒ Object
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 |