Class: Kangaru::Request
- Inherits:
-
Object
- Object
- Kangaru::Request
- Extended by:
- Forwardable
- Includes:
- Configurable
- Defined in:
- lib/kangaru/request.rb
Constant Summary collapse
- DEFAULT_CONTROLLER =
"DefaultController".freeze
- DEFAULT_ACTION =
:default
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #action ⇒ Object
- #controller ⇒ Object
-
#initialize(path:, params:) ⇒ Request
constructor
A new instance of Request.
Methods included from Configurable
Methods included from Concern
#append_features, #class_methods, #included
Constructor Details
#initialize(path:, params:) ⇒ Request
Returns a new instance of Request.
15 16 17 18 |
# File 'lib/kangaru/request.rb', line 15 def initialize(path:, params:) @path = path @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
13 14 15 |
# File 'lib/kangaru/request.rb', line 13 def params @params end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
13 14 15 |
# File 'lib/kangaru/request.rb', line 13 def path @path end |
Instance Method Details
#action ⇒ Object
26 27 28 |
# File 'lib/kangaru/request.rb', line 26 def action path_parser.action || DEFAULT_ACTION end |
#controller ⇒ Object
20 21 22 23 24 |
# File 'lib/kangaru/request.rb', line 20 def controller return default_controller if path_parser.controller.nil? path_parser.controller&.to_class_name(suffix: Controller::SUFFIX) || raise end |