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

Version Path
hyla-1.0.9 lib/hyla/core_ext.rb
hyla-1.0.9.pre.3 lib/hyla/core_ext.rb
hyla-1.0.9.pre.2 lib/hyla/core_ext.rb
hyla-1.0.9.pre.1 lib/hyla/core_ext.rb
hyla-1.0.8 lib/hyla/core_ext.rb
hyla-1.0.7 lib/hyla/core_ext.rb
hyla-1.0.7.pre.9 lib/hyla/core_ext.rb
hyla-1.0.7.pre.8 lib/hyla/core_ext.rb
hyla-1.0.7.pre.7 lib/hyla/core_ext.rb
hyla-1.0.7.pre.6 lib/hyla/core_ext.rb
hyla-1.0.7.pre.5 lib/hyla/core_ext.rb
hyla-1.0.7.pre.3 lib/hyla/core_ext.rb
hyla-1.0.7.pre.2 lib/hyla/core_ext.rb
hyla-1.0.7.pre.1 lib/hyla/core_ext.rb
hyla-1.0.6 lib/hyla/core_ext.rb
hyla-1.0.5 lib/hyla/core_ext.rb
hyla-1.0.5.pre.1 lib/hyla/core_ext.rb
hyla-1.0.4 lib/hyla/core_ext.rb