Sha256: 444c9f9135ceeb10d0d5f6271100a680e838bd67f01b24cbbd96a4703f9445bc
Contents?: true
Size: 566 Bytes
Versions: 18
Compression:
Stored size: 566 Bytes
Contents
class Hash # Merges self with another hash, recursively. # # This code was lovingly stolen from some random gem: # http://gemjack.com/gems/tartan-0.1.1/classes/Hash.html # # Thanks to whoever made it. def deep_merge(hash) target = dup hash.keys.each do |key| if hash[key].is_a? Hash and self[key].is_a? Hash target[key] = target[key].deep_merge(hash[key]) next end target[key] = hash[key] end target end end class String # # Get the first position # def initial self[0,1] end end
Version data entries
18 entries across 18 versions & 1 rubygems