Class: Logripper::Exporter

Inherits:
Object
  • Object
show all
Defined in:
lib/logripper/exporter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parsed_log) ⇒ Exporter

Returns a new instance of Exporter.



7
8
9
# File 'lib/logripper/exporter.rb', line 7

def initialize(parsed_log)
  @parsed_log = parsed_log
end

Instance Attribute Details

#parsed_logObject (readonly)

Returns the value of attribute parsed_log.



5
6
7
# File 'lib/logripper/exporter.rb', line 5

def parsed_log
  @parsed_log
end

Instance Method Details

#to_csvObject



11
12
13
14
15
16
17
18
# File 'lib/logripper/exporter.rb', line 11

def to_csv
  CSV.generate do |csv|
    csv << parsed_log.first.keys
    parsed_log.each do |log_entry|
      csv << log_entry.values
    end
  end
end