class Naplug::Output

Attributes

long_text[R]
text_output[RW]

Implements Text Output and Long Text elements from the Nagios Plugin API

Public Class Methods

new(text_output = 'uninitialized plugin') click to toggle source
# File lib/naplug/output.rb, line 11
def initialize(text_output = 'uninitialized plugin')
  @text_output = text_output
  @long_text = []
end

Public Instance Methods

push(*long_text) click to toggle source

Pushes the given long text strings on the end of long text. Returns the long_text @return [Array<String>] array of long text strings

# File lib/naplug/output.rb, line 18
def push(*long_text)
  @long_text.push long_text
end
to_s(output = :text_output) click to toggle source
# 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