Class: Veye::User::FavoriteCSV
- Defined in:
- lib/veye/views/user/favorite_csv.rb
Instance Method Summary collapse
- #format(results) ⇒ Object
-
#initialize ⇒ FavoriteCSV
constructor
A new instance of FavoriteCSV.
- #print_row(result, index = 1) ⇒ Object
Methods inherited from BaseCSV
Constructor Details
#initialize ⇒ FavoriteCSV
Returns a new instance of FavoriteCSV.
6 7 8 9 |
# File 'lib/veye/views/user/favorite_csv.rb', line 6 def initialize headers = "index,name,prod_key,prod_type,version,language" super(headers) end |
Instance Method Details
#format(results) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/veye/views/user/favorite_csv.rb', line 11 def format(results) return nil if results.nil? items = results['favorites'] return if items.nil? items.each_with_index {|result, index| print_row(result, index)} end |
#print_row(result, index = 1) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/veye/views/user/favorite_csv.rb', line 18 def print_row(result, index = 1) row = sprintf("%d,%s,%s,%s,%s,%s\n", index + 1, result['name'], result['prod_key'], result['prod_type'], result['version'], result['language'] ) puts row end |