Class: Mycommands::ParamController

Inherits:
Controller show all
Defined in:
lib/mycommands/controllers/param_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

#show(params = nil) ⇒ Object



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

def show params = nil
  @params ||= params
  @param = @params.current_param.description
  render
end

#update(input) ⇒ Object



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

def update input
  @params.current_param.substitute input
  @params.next_param
  if @params.all_substituted?
    @application.dispatch([:Command, :update])
  else
    @application.dispatch([:Param, :show])
  end
end