Class: Mycommands::CommandController

Inherits:
Controller show all
Defined in:
lib/mycommands/controllers/command_controller.rb

Instance Method Summary collapse

Methods inherited from Controller

#initialize, #render

Constructor Details

This class inherits a constructor from Mycommands::Controller

Instance Method Details

#index(category) ⇒ Object



3
4
5
6
7
# File 'lib/mycommands/controllers/command_controller.rb', line 3

def index category
  @category = category
  @commands = @model.commands(category)
  render unless @commands.empty?
end

#show(choice) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/mycommands/controllers/command_controller.rb', line 9

def show choice
  require 'clipboard'
  @command = @model.command @category, choice
  if @command.has_params?
    Factory::get(:ParamController).show(@command.params)
    return
  end
  render
  Clipboard.copy @command.command_string
  exit
end

#updateObject



21
22
23
24
25
# File 'lib/mycommands/controllers/command_controller.rb', line 21

def update
  render :show
  Clipboard.copy @command.finished_command
  exit
end