Sha256: 6bc74587aed227b463ebb8b7c1b4e783382d317bb53a519f4d3dec1e88285d90

Contents?: true

Size: 420 Bytes

Versions: 34

Compression:

Stored size: 420 Bytes

Contents

class Hash # :nodoc: 
  
  # Thanks merb!
  def symbolize_keys!
    each do |k,v| 
      sym = k.respond_to?(:to_sym) ? k.to_sym : k 
      self[sym] = Hash === v ? v.symbolize_keys! : v 
      delete(k) unless k == sym
    end
    self
  end
  
  def rename(candidates)
    candidates.each do |old_key, new_key|
      self[new_key] = self.delete(old_key) if self.has_key?(old_key)
    end
    
    return self
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
benschwarz-smoke-0.2.3 lib/core_ext/hash.rb
benschwarz-smoke-0.2.4 lib/core_ext/hash.rb
benschwarz-smoke-0.3.10 lib/core_ext/hash.rb
benschwarz-smoke-0.3.11 lib/core_ext/hash.rb
benschwarz-smoke-0.3.4 lib/core_ext/hash.rb
benschwarz-smoke-0.3.5 lib/core_ext/hash.rb
benschwarz-smoke-0.3.6 lib/core_ext/hash.rb
benschwarz-smoke-0.3.7 lib/core_ext/hash.rb
benschwarz-smoke-0.3.9 lib/core_ext/hash.rb
benschwarz-smoke-0.4.0 lib/core_ext/hash.rb
benschwarz-smoke-0.4.1 lib/core_ext/hash.rb
benschwarz-smoke-0.4.2 lib/core_ext/hash.rb
benschwarz-smoke-0.5.0 lib/core_ext/hash.rb
benschwarz-smoke-0.5.1 lib/core_ext/hash.rb
benschwarz-smoke-0.5.10 lib/core_ext/hash.rb
benschwarz-smoke-0.5.13 lib/core_ext/hash.rb
benschwarz-smoke-0.5.2 lib/core_ext/hash.rb
benschwarz-smoke-0.5.3 lib/core_ext/hash.rb
benschwarz-smoke-0.5.4 lib/core_ext/hash.rb
benschwarz-smoke-0.5.5 lib/core_ext/hash.rb