Method: SlackNotification.say

Defined in:
lib/app/models/slack_notification.rb

.say(message, to: nil, from: nil, template: nil) ⇒ Object

Convenience method to say something when we see something



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/app/models/slack_notification.rb', line 62

def self.say(message, to: nil, from: nil, template: nil)
  notification = SlackNotification.new(to: to, from: from)
  notification.message = if template.present?
                           notification.message_from_template template, message
                         elsif message.is_a?(Array)
                           message.join("\n")
                         else
                           message
                         end
  notification.send_notification
end