Module: Mongoo::Modifiers

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

Instance Method Summary collapse

Instance Method Details

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


207
208
209
210
211
# File 'lib/mongoo/modifiers.rb', line 207

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

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


213
214
215
216
217
# File 'lib/mongoo/modifiers.rb', line 213

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