Class: Mycommands::CategoryView

Inherits:
View
  • Object
show all
Defined in:
lib/mycommands/views/category_view.rb

Instance Method Summary collapse

Methods inherited from View

#add_default_routes, #header, #initialize, #print

Constructor Details

This class inherits a constructor from Mycommands::View

Instance Method Details

#indexObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/mycommands/views/category_view.rb', line 3

def index
  add_default_routes
  if @category
    header "Categories in \"#{@category}\""
  else
    header "Categories"
  end
  @categories.each_with_index do |(category, value), index|
    choice = @router.add_route(:controller => :Category, :action => :index, :input => (index+1).to_s)
    print "#{choice} - #{category.name.cyan}"
  end
end