Class: Mycommands::View

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

Direct Known Subclasses

ApplicationView, CategoryView, CommandView, ParamView

Instance Method Summary collapse

Constructor Details

#initialize(printer = Factory::get(:Printer)) ⇒ View

Returns a new instance of View.



40
41
42
43
# File 'lib/mycommands/views/view.rb', line 40

def initialize printer = Factory::get(:Printer)
  @router = Factory::get(:Router)
  @printer = printer
end

Instance Method Details

#add_default_routesObject



53
54
55
# File 'lib/mycommands/views/view.rb', line 53

def add_default_routes
  @router.add_route(:match => '0', :controller => "Category", :action => "index", :input => '0')
end

#header(text) ⇒ Object



49
50
51
# File 'lib/mycommands/views/view.rb', line 49

def header text
  print "\n    "+"#{text}".underline
end


45
46
47
# File 'lib/mycommands/views/view.rb', line 45

def print string
  @printer.print string
end