Class: Veye::Project::InfoCSV
- Defined in:
- lib/veye/views/project/info_csv.rb
Instance Method Summary collapse
- #format(results) ⇒ Object
-
#initialize ⇒ InfoCSV
constructor
A new instance of InfoCSV.
Methods inherited from BaseCSV
Constructor Details
#initialize ⇒ InfoCSV
Returns a new instance of InfoCSV.
6 7 8 9 |
# File 'lib/veye/views/project/info_csv.rb', line 6 def initialize headers = "nr,name,project_id,public,period,source,dep_number,out_number,created_at" super(headers) end |
Instance Method Details
#format(results) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/veye/views/project/info_csv.rb', line 10 def format(results) return nil if results.nil? results = [results] if results.is_a? Hash results.each_with_index do |result, index| #BUG: API returns raw mongoID value as id when fetching a list of projects if result['id'].is_a?(Hash) result['id'] = result['id'].values.first end printf("%d,%s,%s,%s,%s,%s,%s,%s,%s\n", index + 1, result['name'], result['id'], result['public'], result['period'], result['source'], result['dep_number'], result['out_number'], result['created_at']) end end |