Sha256: 2066cdb5e88d911924aabc819297accdc55176a57dc7e1d038c86b0e10a9fcec

Contents?: true

Size: 274 Bytes

Versions: 1

Compression:

Stored size: 274 Bytes

Contents

module HashEasy
  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
end

Version data entries

1 entries across 1 versions & 1 rubygems

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