Sha256: 722c0b563ef7264fa3a5ebd666e85f6d018c5aa59c59895757cf7a12506634d0

Contents?: true

Size: 271 Bytes

Versions: 7

Compression:

Stored size: 271 Bytes

Contents

class Hash

  # As with #store but only if the key isn't
  # already in the hash.
  #
  # TODO: Would #store? be a better name?
  #
  #  CREDIT: Trans

  def insert(name, value)
    if key?(name)
      false
    else
      store(name,value)
      true
    end
  end

end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
facets-2.4.0 lib/facets/hash/insert.rb
facets-2.4.1 lib/facets/hash/insert.rb
facets-2.4.4 lib/core/facets/hash/insert.rb
facets-2.4.2 lib/core/facets/hash/insert.rb
facets-2.4.3 lib/core/facets/hash/insert.rb
facets-2.4.5 lib/core/facets/hash/insert.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/core/facets/hash/insert.rb