Module Wrest::CoreExt::Hash::Conversions

  1. lib/wrest/core_ext/hash/conversions.rb

Makes it easier to build other objects from a Hash


public instance

  1. mutate_using

Public instance methods

mutate_using (mutator)

This method accepts a hash mutator (found in Wrest::Compononents) to build a new hash map by making changes to an existing one.

No, this method does not mutate the state of the hash it is invoked on, but rather builds a new one.

Yes, the name is misleading in that respect. However, one hopes the absence of an exclamation mark will increase clarity.

Uses include mutating the hash produced by deserialising xml by using the meta data in the hash to type cast values.

Example: “".to_uri.get(

  :appid  => 'YahooDemo',
  :output => 'xml',
  :query  => 'India',
  :results=> '3',
  :start  => '1'
[show source]
    # File lib/wrest/core_ext/hash/conversions.rb, line 36
36:         def mutate_using(mutator)
37:           mutated_hash = {}
38:             self.each{|tuple|*mutator.mutate(tuple))}
39:           mutated_hash
40:         end