Module: MongoMapper::Utils

Defined in:
lib/mongo_mapper/utils.rb

Class Method Summary collapse

Class Method Details

.get_safe_options(options) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/mongo_mapper/utils.rb', line 3

def self.get_safe_options(options)
  return {} unless options and options.key? :safe
  safe = options[:safe]
  safe = {:w => 1} if safe == true
  safe = {:w => 0} if safe == false
  safe = {:w => safe} if safe.is_a? Integer
  safe
end