Class: Icinga::CSVResponder

Inherits:
Responder show all
Defined in:
lib/icinga/responder/csv.rb

Instance Method Summary collapse

Methods inherited from Responder

create, #each, #initialize, #response, #to_s

Constructor Details

This class inherits a constructor from Icinga::Responder

Instance Method Details

#dataObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/icinga/responder/csv.rb', line 5

def data
  parse_options = {:headers => :first_row, :col_sep => ";", :quote_char => "'"}

  CSV.parse(response.body.strip, parse_options).collect do |row|
    new_hash = {}
    row.to_hash.each_pair do |k,v|
      new_hash.merge!({k.downcase => v}) 
    end
    new_hash
  end
end