Class: Naplug::Output
- Inherits:
-
Object
- Object
- Naplug::Output
- Defined in:
- lib/naplug/output.rb
Instance Attribute Summary collapse
-
#long_text ⇒ Object
readonly
Returns the value of attribute long_text.
-
#text_output ⇒ Object
Implements Text Output and Long Text elements from the Nagios Plugin API * Nagios v3: nagios.sourceforge.net/docs/nagioscore/3/en/pluginapi.html * Nagios v4: nagios.sourceforge.net/docs/nagioscore/4/en/pluginapi.html.
Instance Method Summary collapse
-
#initialize(text_output = 'uninitialized plugin') ⇒ Output
constructor
A new instance of Output.
-
#push(*long_text) ⇒ Array<String>
Pushes the given long text strings on the end of long text.
- #to_s(output = :text_output) ⇒ Object
Constructor Details
#initialize(text_output = 'uninitialized plugin') ⇒ Output
Returns a new instance of Output.
11 12 13 14 |
# File 'lib/naplug/output.rb', line 11 def initialize(text_output = 'uninitialized plugin') @text_output = text_output @long_text = [] end |
Instance Attribute Details
#long_text ⇒ Object (readonly)
Returns the value of attribute long_text.
9 10 11 |
# File 'lib/naplug/output.rb', line 9 def long_text @long_text end |
#text_output ⇒ Object
Implements Text Output and Long Text elements from the Nagios Plugin API
8 9 10 |
# File 'lib/naplug/output.rb', line 8 def text_output @text_output end |
Instance Method Details
#push(*long_text) ⇒ Array<String>
Pushes the given long text strings on the end of long text. Returns the long_text
18 19 20 |
# File 'lib/naplug/output.rb', line 18 def push(*long_text) @long_text.push long_text end |
#to_s(output = :text_output) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/naplug/output.rb', line 22 def to_s(output = :text_output) case output when :text_output then @text_output when :long_text then @long_text.join "\n" else nil end end |