Class: GrapeSwagger::Endpoint::ParamsParser
- Inherits:
-
Object
- Object
- GrapeSwagger::Endpoint::ParamsParser
- Defined in:
- lib/grape-swagger/endpoint/params_parser.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params, settings) ⇒ ParamsParser
constructor
A new instance of ParamsParser.
- #parse_request_params ⇒ Object
Constructor Details
#initialize(params, settings) ⇒ ParamsParser
12 13 14 15 |
# File 'lib/grape-swagger/endpoint/params_parser.rb', line 12 def initialize(params, settings) @params = params @settings = settings end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'lib/grape-swagger/endpoint/params_parser.rb', line 6 def params @params end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
6 7 8 |
# File 'lib/grape-swagger/endpoint/params_parser.rb', line 6 def settings @settings end |
Class Method Details
.parse_request_params(params, settings) ⇒ Object
8 9 10 |
# File 'lib/grape-swagger/endpoint/params_parser.rb', line 8 def self.parse_request_params(params, settings) new(params, settings).parse_request_params end |
Instance Method Details
#parse_request_params ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/grape-swagger/endpoint/params_parser.rb', line 17 def parse_request_params public_params.each_with_object({}) do |(name, ), memo| name = name.to_s param_type = [:type] param_type = param_type.to_s unless param_type.nil? if param_type_is_array?(param_type) [:is_array] = true name += '[]' if array_use_braces? end memo[name] = end end |