123456789_123456789_123456789_123456789_123456789_

Class: Mongoid::Atomic::Paths::Root

Relationships & Source Files
Inherits: Object
Defined in: lib/mongoid/atomic/paths/root.rb

Overview

This class encapsulates behavior for locating and updating root documents atomically.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

  • #insert_modifier

    Asking for the insert modifier on a document with a root path indicates a mixed association most likely happened.

Constructor Details

.new(document) ⇒ Root

Create the new root path utility.

Examples:

Create the root path util.

Root.new(document)

Parameters:

  • document (Document)

    The document to generate the paths for.

[ GitHub ]

  
# File 'lib/mongoid/atomic/paths/root.rb', line 20

def initialize(document)
  @document, @path, @position = document, "", ""
end

Instance Attribute Details

#document (readonly)

[ GitHub ]

  
# File 'lib/mongoid/atomic/paths/root.rb', line 12

attr_reader :document, :path, :position

#path (readonly)

[ GitHub ]

  
# File 'lib/mongoid/atomic/paths/root.rb', line 12

attr_reader :document, :path, :position

#position (readonly)

[ GitHub ]

  
# File 'lib/mongoid/atomic/paths/root.rb', line 12

attr_reader :document, :path, :position

Instance Method Details

#insert_modifier

Asking for the insert modifier on a document with a root path indicates a mixed association most likely happened.

Examples:

Attempt to get the insert modifier.

root.insert_modifier

Raises:

[ GitHub ]

  
# File 'lib/mongoid/atomic/paths/root.rb', line 31

def insert_modifier
  raise Errors::InvalidPath.new(document.class)
end