Class: Veye::User::FavoriteTable

Inherits:
BaseTable show all
Defined in:
lib/veye/views/user/favorite_table.rb

Instance Method Summary collapse

Methods inherited from BaseTable

#after, #before

Constructor Details

#initializeFavoriteTable

Returns a new instance of FavoriteTable.



6
7
8
9
# File 'lib/veye/views/user/favorite_table.rb', line 6

def initialize
  headings = %w(nr name product_key version language)
  super("Favorite packages", headings)
end

Instance Method Details

#format(results) ⇒ Object



15
16
17
18
19
20
# File 'lib/veye/views/user/favorite_table.rb', line 15

def format(results)
  return if results.nil?
  items = results['favorites']
  return if items.nil?
  items.each_with_index {|fav, index| @table << make_row(fav, index)}
end

#make_row(fav, index) ⇒ Object



11
12
13
# File 'lib/veye/views/user/favorite_table.rb', line 11

def make_row(fav, index)
  [index + 1, fav['name'], fav['prod_key'], fav['version'], fav['language']]
end