Sha256: 663604d82c8ac4b1b97c74310b680e0cce4e4deaf4450064a082180df7555a10

Contents?: true

Size: 228 Bytes

Versions: 1

Compression:

Stored size: 228 Bytes

Contents

class BottomlessHash < Hash
  def initialize
    super &-> h, k { h[k] = self.class.new }
  end

  def self.from_hash(hash)
    new.merge(hash)
  end
end

class Hash
  def bottomless
    BottomlessHash.from_hash(self)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hash_easy-0.0.1 lib/hash_easy/bottomless_hash.rb