Class: GitPissed::CSV

Inherits:
Format
  • Object
show all
Defined in:
lib/git_pissed/formats/csv.rb

Instance Attribute Summary

Attributes inherited from Format

#options, #words_by_date

Instance Method Summary collapse

Methods inherited from Format

#file_path, #to_s

Instance Method Details

#formattedObject



7
8
9
# File 'lib/git_pissed/formats/csv.rb', line 7

def formatted
  table.join "\n"
end

#nameObject



3
4
5
# File 'lib/git_pissed/formats/csv.rb', line 3

def name
  'CSV'
end

#tableObject



11
12
13
14
15
16
17
# File 'lib/git_pissed/formats/csv.rb', line 11

def table
  [["date", *options.words].join(',')].tap do |table|
    words_by_date.each do |date, words|
      table << [date, words.values_at(*options.words)].join(',')
    end
  end
end