Method: Mongo::Options::Mapper#transform
- Defined in:
- lib/mongo/options/mapper.rb
#transform(options, mappings) ⇒ Hash
Transforms the provided options to a new set of options given the provided mapping.
Options which are not present in the provided mapping are returned unmodified.
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/mongo/options/mapper.rb', line 42 def transform(, mappings) map = transform_keys_to_strings(mappings) opts = transform_keys_to_strings() opts.reduce({}) do |transformed, (key, value)| if map[key] transformed[map[key]] = value else transformed[key] = value end transformed end end |