Class: MVCLI::Controller
- Inherits:
-
Object
- Object
- MVCLI::Controller
- Defined in:
- lib/mvcli/controller.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #call(command) ⇒ Object
- #form ⇒ Object
-
#initialize(name, method, params) ⇒ Controller
constructor
A new instance of Controller.
Constructor Details
#initialize(name, method, params) ⇒ Controller
Returns a new instance of Controller.
8 9 10 |
# File 'lib/mvcli/controller.rb', line 8 def initialize(name, method, params) @name, @method, @params = name, method, params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'lib/mvcli/controller.rb', line 6 def params @params end |
Instance Method Details
#call(command) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/mvcli/controller.rb', line 12 def call(command) response = send @method template = cortex.read :template, "#{@name}/#{@method}" template.call response, command.output return 0 end |
#form ⇒ Object
19 20 21 22 23 24 |
# File 'lib/mvcli/controller.rb', line 19 def form template = cortex.read :form, "#{@name}/#{@method}" form = template.new argv. form.validate! form end |