Sha256: 2711e952fec6f5c5f2073c6178d40edda931afbbead1dc4175527b045768ed60

Contents?: true

Size: 221 Bytes

Versions: 10

Compression:

Stored size: 221 Bytes

Contents

class Hash

  # Instantiate a new hash with a default
  # value determined by the block.
  # 
  # Hash.new_with{ [] } 
  #
  # CREDIT: Pit Capitan

  def self.new_with #:yield:
    new { |h, k| h[k] = yield }
  end

end

Version data entries

10 entries across 9 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/hash/new_with.rb
facets-3.1.0 lib/core/facets/hash/new_with.rb
facets-3.0.0 lib/core/facets/hash/new_with.rb
facets-2.9.3 lib/core/facets/hash/new_with.rb
facets-2.9.2 src/core/facets/hash/new_with.rb
facets-2.9.2 lib/core/facets/hash/new_with.rb
facets-2.9.1 lib/core/facets/hash/new_with.rb
facets-2.9.0 lib/core/facets/hash/new_with.rb
facets-2.9.0.pre.2 lib/core/facets/hash/new_with.rb
facets-2.9.0.pre.1 lib/core/facets/hash/new_with.rb