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) ⇒ ParamConverter
constructor
A new instance of ParamConverter.
Constructor Details
#initialize(param_definitions) ⇒ ParamConverter
Returns a new instance of ParamConverter.
139 140 141 |
# File 'lib/interpol/request_params_parser.rb', line 139 def initialize(param_definitions) @param_definitions = param_definitions end |
Instance Attribute Details
#param_definitions ⇒ Object (readonly)
Returns the value of attribute param_definitions.
137 138 139 |
# File 'lib/interpol/request_params_parser.rb', line 137 def param_definitions @param_definitions end |
Instance Method Details
#convert(params) ⇒ Object
143 144 145 146 147 148 149 150 151 |
# File 'lib/interpol/request_params_parser.rb', line 143 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 |