Class: Mongoid::Persistence::Atomic::Operation
- Includes:
- Safe
- Defined in:
- lib/mongoid/persistence/atomic/operation.rb
Overview
This is the superclass for all atomic operation objects.
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(document, field, value, options = {}) ⇒ Operation
constructor
Initialize the new pullAll operation.
-
#operation(modifier) ⇒ Hash
Get the atomic operation to perform.
Methods included from Safe
Constructor Details
#initialize(document, field, value, options = {}) ⇒ Operation
Initialize the new pullAll operation.
23 24 25 26 |
# File 'lib/mongoid/persistence/atomic/operation.rb', line 23 def initialize(document, field, value, = {}) @document, @field, @value = document, field, value @options = { :safe => safe_mode?() } end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
10 11 12 |
# File 'lib/mongoid/persistence/atomic/operation.rb', line 10 def document @document end |
#field ⇒ Object (readonly)
Returns the value of attribute field.
10 11 12 |
# File 'lib/mongoid/persistence/atomic/operation.rb', line 10 def field @field end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/mongoid/persistence/atomic/operation.rb', line 10 def @options end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
10 11 12 |
# File 'lib/mongoid/persistence/atomic/operation.rb', line 10 def value @value end |
Instance Method Details
#operation(modifier) ⇒ Hash
Get the atomic operation to perform.
38 39 40 |
# File 'lib/mongoid/persistence/atomic/operation.rb', line 38 def operation(modifier) { modifier => { field => value } } end |