Class: Aldous::Controller::ActionExecutionService
- Inherits:
-
Object
- Object
- Aldous::Controller::ActionExecutionService
- Defined in:
- lib/aldous/controller/action_execution_service.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#controller_action_class ⇒ Object
readonly
Returns the value of attribute controller_action_class.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(controller, controller_action_class) ⇒ ActionExecutionService
constructor
A new instance of ActionExecutionService.
- #perform ⇒ Object
Constructor Details
#initialize(controller, controller_action_class) ⇒ ActionExecutionService
Returns a new instance of ActionExecutionService.
16 17 18 19 |
# File 'lib/aldous/controller/action_execution_service.rb', line 16 def initialize(controller, controller_action_class) @controller = controller @controller_action_class = controller_action_class end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
14 15 16 |
# File 'lib/aldous/controller/action_execution_service.rb', line 14 def controller @controller end |
#controller_action_class ⇒ Object (readonly)
Returns the value of attribute controller_action_class.
14 15 16 |
# File 'lib/aldous/controller/action_execution_service.rb', line 14 def controller_action_class @controller_action_class end |
Class Method Details
.perform(controller, controller_action_class) ⇒ Object
9 10 11 |
# File 'lib/aldous/controller/action_execution_service.rb', line 9 def perform(controller, controller_action_class) self.new(controller, controller_action_class).perform end |
Instance Method Details
#perform ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/aldous/controller/action_execution_service.rb', line 21 def perform action = controller_action_class.build(controller) precondition, precondition_result = PreconditionsExecutionService.new(action, controller).perform action_result = nil if precondition_result action = precondition action_result = precondition_result else action_result = action.perform end Action::ResultExecutionService.perform(controller, action_result, action.default_view_data) rescue => e LoggingWrapper.log(e) controller.head :internal_server_error end |