module HubSpot

Constants

VERSION

Public Instance Methods

stringify_keys(hash) click to toggle source

Convert keys to strings

# File lib/hub_spot.rb, line 32
def stringify_keys(hash)
  transform_hash(hash) {|hash, key, value|       
    hash[key.to_s] = value
  }
end
transform_hash(original, options={}, &block) click to toggle source

From @avdi per www.virtuouscode.com/2009/11/20/hash-transforms-in-ruby/

# File lib/hub_spot.rb, line 19
def transform_hash(original, options={}, &block)
  original.inject({}){|result, (key,value)|
    value = if (options[:deep] && Hash === value) 
              transform_hash(value, options, &block)
            else 
              value
            end
    block.call(result,key,value)
    result
  }
end