Class: Mycommands::CommandView

Inherits:
View
  • Object
show all
Defined in:
lib/mycommands/views/command_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

#empty_category(category) ⇒ Object



17
18
19
# File 'lib/mycommands/views/command_view.rb', line 17

def empty_category category
  print "No commands or categories in \"#{category}\""
end

#indexObject



3
4
5
6
7
8
9
10
# File 'lib/mycommands/views/command_view.rb', line 3

def index
  add_default_routes
  header "Commands in \"#{@category}\""
  @commands.each_with_index do |(command, value), index|
    choice = @router.add_route(:controller => :Command, :action => :show, :input => index.to_s)
    print "#{choice} - #{command.description.green}"
  end
end

#showObject



12
13
14
15
# File 'lib/mycommands/views/command_view.rb', line 12

def show
  print "\nThe command below has been copied to the clipboard
#{@command.finished_command.green}\n\n"
end