Class: Mongo::WriteConcern::Base
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
|
Subclasses:
|
|
| Inherits: | Object |
| Defined in: | lib/mongo/write_concern/base.rb |
Overview
Defines common behavior for write concerns.
Class Method Summary
-
.new(options) ⇒ Base
constructor
Internal use only
Instantiate a new write concern given the options.
Instance Attribute Summary
- #options ⇒ Hash readonly
Constructor Details
.new(options) ⇒ Base
Instantiate a new write concern given the options.
# File 'lib/mongo/write_concern/base.rb', line 45
def initialize() = Options::Mapper.transform_keys_to_symbols() = Options::Mapper.transform_values_to_strings().freeze if [:w] if [:w] == 0 && [:j] raise Error::InvalidWriteConcern, "Invalid write concern options: :j cannot be true when :w is 0: #{.inspect}" elsif [:w] == 0 && [:fsync] raise Error::InvalidWriteConcern, "Invalid write concern options: :fsync cannot be true when :w is 0: #{.inspect}" elsif [:w].is_a?(Integer) && [:w] < 0 raise Error::InvalidWriteConcern, "Invalid write concern options: :w cannot be negative (#{[:w]}): #{.inspect}" end end if [:journal] raise Error::InvalidWriteConcern, "Invalid write concern options: use :j for journal: #{.inspect}" end @options = end
Instance Attribute Details
#options ⇒ Hash (readonly)
# File 'lib/mongo/write_concern/base.rb', line 24
attr_reader :