Class: Interpol::RequestParamsParser::ParamConverter
- Inherits:
-
Object
- Object
- Interpol::RequestParamsParser::ParamConverter
- Defined in:
- lib/interpol/request_params_parser.rb
Overview
Private: This takes care of the parameter conversions.
Instance Attribute Summary collapse
-
#param_definitions ⇒ Object
readonly
Returns the value of attribute param_definitions.
Instance Method Summary collapse
- #convert(params) ⇒ Object
-
#initialize(param_definitions, configuration) ⇒ ParamConverter
constructor
A new instance of ParamConverter.
Constructor Details
#initialize(param_definitions, configuration) ⇒ ParamConverter
Returns a new instance of ParamConverter.
132 133 134 135 |
# File 'lib/interpol/request_params_parser.rb', line 132 def initialize(param_definitions, configuration) @param_definitions = param_definitions @configuration = configuration end |
Instance Attribute Details
#param_definitions ⇒ Object (readonly)
Returns the value of attribute param_definitions.
130 131 132 |
# File 'lib/interpol/request_params_parser.rb', line 130 def param_definitions @param_definitions end |
Instance Method Details
#convert(params) ⇒ Object
137 138 139 140 141 142 143 144 145 |
# File 'lib/interpol/request_params_parser.rb', line 137 def convert(params) @param_definitions.keys.each_with_object({}) do |name, hash| hash[name] = if params.has_key?(name) convert_param(name, params.fetch(name)) else nil end end end |