Class: Gemsurance::Formatters::Csv

Inherits:
Base
  • Object
show all
Defined in:
lib/gemsurance/formatters/csv.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #output_path, #sorted_gems

Constructor Details

This class inherits a constructor from Gemsurance::Formatters::Base

Instance Method Details

#formatObject



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

def format
  @extension = "csv"

  file = ""
  title_attributes = GemInfoRetriever::GemInfo::GEM_ATTRIBUTES.map {|attr| attr.to_s }
  file << CSV.generate_line(title_attributes)

  sorted_gems.each do |gem|
    file << gem.to_csv
  end
  file
end