Method: Hash#insert

Defined in:
lib/core/facets/hash/insert.rb

#insert(name, value) ⇒ Object

As with #store but only if the key isn’t already in the hash.

TODO: Would #store? be a better name?

CREDIT: Trans



10
11
12
13
14
15
16
17
# File 'lib/core/facets/hash/insert.rb', line 10

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