Sha256: 0afa6fd5ef7128058829dc8b8990ce13b11f55f0f58f9790f1e332b4c0322cd1

Contents?: true

Size: 829 Bytes

Versions: 1

Compression:

Stored size: 829 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


require 'ostruct'
class ClosedStruct < OpenStruct
  def method_missing(symbol, *args)
    raise(NoMethodError, "undefined method `#{symbol}' for #{self}")
  end
end

# Thanks, ActiveSupport!
class Date
  # Converts datetime to an appropriate format for use in XML
  def xmlschema
    strftime("%Y-%m-%dT%H:%M:%S%Z")
  end if RUBY_VERSION < '1.9'
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jberkel-jekyll-0.5.4 lib/jekyll/core_ext.rb