Class: RequestHandler::Base
- Inherits:
-
Object
- Object
- RequestHandler::Base
- Defined in:
- lib/request_handler/base.rb
Class Attribute Summary collapse
-
.config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #body_params ⇒ Object
- #field_set_params ⇒ Object
- #filter_params ⇒ Object
- #headers ⇒ Object
- #include_params ⇒ Object
-
#initialize(request:) ⇒ Base
constructor
A new instance of Base.
- #page_params ⇒ Object
- #sort_params ⇒ Object
Constructor Details
#initialize(request:) ⇒ Base
Returns a new instance of Base.
26 27 28 29 |
# File 'lib/request_handler/base.rb', line 26 def initialize(request:) raise MissingArgumentError, request: 'is missing' if request.nil? @request = request end |
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
24 25 26 |
# File 'lib/request_handler/base.rb', line 24 def config @config end |
Class Method Details
.inherited(subclass) ⇒ Object
19 20 21 22 |
# File 'lib/request_handler/base.rb', line 19 def inherited(subclass) return if @config.nil? subclass.config = @config.deep_copy end |
.options(&block) ⇒ Object
14 15 16 17 |
# File 'lib/request_handler/base.rb', line 14 def (&block) @config ||= ::Confstruct::Configuration.new @config.configure(&block) end |
Instance Method Details
#body_params ⇒ Object
54 55 56 |
# File 'lib/request_handler/base.rb', line 54 def body_params @body_params ||= handle_body_params end |
#field_set_params ⇒ Object
58 59 60 |
# File 'lib/request_handler/base.rb', line 58 def field_set_params @field_set_params ||= handle_field_set_params end |
#filter_params ⇒ Object
31 32 33 |
# File 'lib/request_handler/base.rb', line 31 def filter_params @filter_params ||= handle_filter_params end |
#headers ⇒ Object
50 51 52 |
# File 'lib/request_handler/base.rb', line 50 def headers @headers ||= HeaderHandler.new(env: request.env).run end |
#include_params ⇒ Object
42 43 44 |
# File 'lib/request_handler/base.rb', line 42 def include_params @include_params ||= handle_include_params end |
#page_params ⇒ Object
35 36 37 38 39 40 |
# File 'lib/request_handler/base.rb', line 35 def page_params @page_params ||= PageHandler.new( params: params, page_config: config.lookup!('page') ).run end |
#sort_params ⇒ Object
46 47 48 |
# File 'lib/request_handler/base.rb', line 46 def sort_params @sort_params ||= handle_sort_params end |