Class: Mongoid::Atomic::Paths::Root
- Inherits:
-
Object
- Object
- Mongoid::Atomic::Paths::Root
- Defined in:
- lib/mongoid/atomic/paths/root.rb
Overview
This class encapsulates behaviour for locating and updating root documents atomically.
Instance Attribute Summary (collapse)
-
- (Object) document
readonly
Returns the value of attribute document.
-
- (Object) path
readonly
Returns the value of attribute path.
-
- (Object) position
readonly
Returns the value of attribute position.
Instance Method Summary (collapse)
-
- (Root) initialize(document)
constructor
Create the new root path utility.
-
- (Hash) selector
Get the selector to use for the root document when performing atomic updates.
Constructor Details
- (Root) initialize(document)
Create the new root path utility.
20 21 22 |
# File 'lib/mongoid/atomic/paths/root.rb', line 20 def initialize(document) @document, @path, @position = document, "", "" end |
Instance Attribute Details
- (Object) document (readonly)
Returns the value of attribute document
10 11 12 |
# File 'lib/mongoid/atomic/paths/root.rb', line 10 def document @document end |
- (Object) path (readonly)
Returns the value of attribute path
10 11 12 |
# File 'lib/mongoid/atomic/paths/root.rb', line 10 def path @path end |
- (Object) position (readonly)
Returns the value of attribute position
10 11 12 |
# File 'lib/mongoid/atomic/paths/root.rb', line 10 def position @position end |
Instance Method Details
- (Hash) selector
Get the selector to use for the root document when performing atomic updates. When sharding this will include the shard key.
33 34 35 |
# File 'lib/mongoid/atomic/paths/root.rb', line 33 def selector { "_id" => document._id }.merge!(document.shard_key_selector) end |