Class: Plutonium::Interaction::Response::Base Abstract
- Inherits:
-
Object
- Object
- Plutonium::Interaction::Response::Base
- Defined in:
- lib/plutonium/interaction/response/base.rb
Overview
This class is abstract.
Subclass and override #execute to implement specific response behavior.
Base class for interaction responses.
This class provides common functionality for handling flash messages and processing responses in controllers.
Instance Attribute Summary collapse
-
#flash ⇒ Array<Array(String, Symbol)>
readonly
Flash messages associated with the response.
Instance Method Summary collapse
-
#initialize(*args, **options) ⇒ Base
constructor
Initializes a new Response::Base instance.
-
#process(controller) {|Object| ... } ⇒ void
Processes the response in the context of a controller.
-
#with_flash(messages) ⇒ self
Adds flash messages to the response.
Constructor Details
#initialize(*args, **options) ⇒ Base
Initializes a new Response::Base instance.
16 17 18 19 20 |
# File 'lib/plutonium/interaction/response/base.rb', line 16 def initialize(*args, **) @args = args @options = @flash = [] end |
Instance Attribute Details
#flash ⇒ Array<Array(String, Symbol)> (readonly)
Returns Flash messages associated with the response.
13 14 15 |
# File 'lib/plutonium/interaction/response/base.rb', line 13 def flash @flash end |
Instance Method Details
#process(controller) {|Object| ... } ⇒ void
This method returns an undefined value.
Processes the response in the context of a controller.
27 28 29 30 |
# File 'lib/plutonium/interaction/response/base.rb', line 27 def process(controller, &) set_flash(controller) execute(controller, &) end |
#with_flash(messages) ⇒ self
Adds flash messages to the response.
36 37 38 39 |
# File 'lib/plutonium/interaction/response/base.rb', line 36 def with_flash() @flash.concat() unless .blank? self end |