Module: Mongoo::Modifiers

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

Instance Method Summary collapse

Instance Method Details

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



199
200
201
202
203
# File 'lib/mongoo/modifiers.rb', line 199

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

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



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

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