Module: Mongoo::Modifiers

Included in:
Base
Defined in:
lib/mongoo/modifiers.rb

Instance Method Summary collapse

Instance Method Details

#mod(opts = {}, &block) ⇒ Object


204
205
206
207
208
# File 'lib/mongoo/modifiers.rb', line 204

def mod(opts={}, &block)
  builder = ModifierBuilder.new(opts, self)
  block.call(builder)
  builder.run!
end

#mod!(opts = {}, &block) ⇒ Object


210
211
212
213
214
# File 'lib/mongoo/modifiers.rb', line 210

def mod!(opts={}, &block)
  opts[:update_opts] ||= {}
  opts[:update_opts][:safe] = true
  mod(opts, &block)
end