Class: Veye::Project::LicenceCSV

Inherits:
BaseCSV
  • Object
show all
Defined in:
lib/veye/views/project/licence_csv.rb

Instance Method Summary collapse

Methods inherited from BaseCSV

#after, #before

Constructor Details

#initializeLicenceCSV

Returns a new instance of LicenceCSV.



6
7
8
9
# File 'lib/veye/views/project/licence_csv.rb', line 6

def initialize
  headers = "nr,license,product_keys"
  super(headers)
end

Instance Method Details

#format(results) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/veye/views/project/licence_csv.rb', line 10

def format(results)
  return nil if results.nil?
  n = 1
  results["licenses"].each_pair do |license, prods|
    prod_keys = prods.map {|p| p["prod_key"]}
    printf("%d,%s,%s\n", n, license, prod_keys.join(','))
    n += 1
  end
end