Class: Toqua::TransformParams::ParameterConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/toqua/transform_params.rb

Instance Method Summary collapse

Instance Method Details

#parse(params, hash, block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/toqua/transform_params.rb', line 6

def parse(params, hash, block)
  if Hash === hash
    key = hash.keys.first

    if params.key?(key)
      parse(params[key], hash[key], block)
    end
  else
    if params.key?(hash)
      params[hash] = block.call(params[hash])
    end
  end
end