Class: NagiosHerald::Message::IRC
- Inherits:
-
NagiosHerald::Message
- Object
- NagiosHerald::Message
- NagiosHerald::Message::IRC
- Defined in:
- lib/nagios-herald/messages/irc.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Attributes inherited from NagiosHerald::Message
Instance Method Summary collapse
-
#curate_text ⇒ Object
Public: Generates the text portion of the content hash.
-
#initialize(recipients, options = {}) ⇒ IRC
constructor
Public: Initializes a new Message::IRC object.
-
#print ⇒ Object
Public: Prints the text content to the terminal.
-
#send ⇒ Object
Public: Sends the IRC message.
Methods inherited from NagiosHerald::Message
Methods included from Util
#get_nagios_var, get_script_path, load_helper, underscore_to_camel_case, #unescape_text
Methods included from Logging
#configure_logger_for, #logger, #logger_for
Constructor Details
#initialize(recipients, options = {}) ⇒ IRC
Public: Initializes a new Message::IRC object.
recipients - A list of recipients for this message. options - The options hash from Executor. FIXME: Is that ^^ necessary now with Config.config available?
Returns a new Message::IRC object.
17 18 19 20 |
# File 'lib/nagios-herald/messages/irc.rb', line 17 def initialize(recipients, = {}) @text = "" super(recipients, ) end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
8 9 10 |
# File 'lib/nagios-herald/messages/irc.rb', line 8 def text @text end |
Instance Method Details
#curate_text ⇒ Object
Public: Generates the text portion of the content hash.
Returns the full text portion of the content hash.
25 26 27 28 29 30 |
# File 'lib/nagios-herald/messages/irc.rb', line 25 def curate_text # FIXME: Gonna need to chomp newlines @text += self.content[:text][:host_info] @text += self.content[:text][:state_info] @text += self.content[:text][:alert_ack_url] end |
#print ⇒ Object
Public: Prints the text content to the terminal. Useful for debugging.
Returns nothing.
36 37 38 |
# File 'lib/nagios-herald/messages/irc.rb', line 36 def print puts @text end |
#send ⇒ Object
Public: Sends the IRC message.
Returns nothing.
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/nagios-herald/messages/irc.rb', line 43 def send curate_text if @no_send self.print return end # TODO: Actually make this send to an IRC server # I expect the IRC server will be a value in the config self.print end |