Class: MuchRails::Action::BaseCommandResult
- Inherits:
-
BaseResult
- Object
- BaseResult
- MuchRails::Action::BaseCommandResult
- Defined in:
- lib/much-rails/action/base_command_result.rb
Overview
MuchRails::Action::BaseCommandResult is a base result that, when executed, runs a generic controller command with some given args.
Direct Known Subclasses
HeadResult, RedirectToResult, SendDataResult, SendFileResult
Instance Attribute Summary collapse
-
#command_args ⇒ Object
readonly
Returns the value of attribute command_args.
-
#command_name ⇒ Object
readonly
Returns the value of attribute command_name.
Instance Method Summary collapse
-
#execute_block ⇒ Object
This block is called using ‘instance_exec` in the scope of the controller.
-
#initialize(command_name, *command_args) ⇒ BaseCommandResult
constructor
A new instance of BaseCommandResult.
Constructor Details
#initialize(command_name, *command_args) ⇒ BaseCommandResult
Returns a new instance of BaseCommandResult.
13 14 15 16 |
# File 'lib/much-rails/action/base_command_result.rb', line 13 def initialize(command_name, *command_args) @command_name = command_name @command_args = command_args end |
Instance Attribute Details
#command_args ⇒ Object (readonly)
Returns the value of attribute command_args.
11 12 13 |
# File 'lib/much-rails/action/base_command_result.rb', line 11 def command_args @command_args end |
#command_name ⇒ Object (readonly)
Returns the value of attribute command_name.
11 12 13 |
# File 'lib/much-rails/action/base_command_result.rb', line 11 def command_name @command_name end |
Instance Method Details
#execute_block ⇒ Object
This block is called using ‘instance_exec` in the scope of the controller
19 20 21 |
# File 'lib/much-rails/action/base_command_result.rb', line 19 def execute_block ->(result){ public_send(result.command_name, *result.command_args) } end |