Module: Mongoid::Extensions::Hash::Accessors

Included in:
Hash
Defined in:
lib/mongoid/extensions/hash/accessors.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#insert(key, attrs) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/mongoid/extensions/hash/accessors.rb', line 6

def insert(key, attrs)
  elements = self[key]
  if elements
    elements.update(attrs)
  else
    self[key] = key.singular? ? attrs : [attrs]
  end
end