Class: Mongoid::Relations::Builder

Inherits:
Object
  • Object
show all
Includes:
Threaded::Lifecycle
Defined in:
lib/mongoid/relations/builder.rb

Overview

Superclass for all builder objects. Builders are responsible for either looking up a relation's target from the database, or creating them from a supplied attributes hash.

Direct Known Subclasses

Mongoid::Relations::Builders::Embedded::In, Mongoid::Relations::Builders::Embedded::Many, Mongoid::Relations::Builders::Embedded::One, Mongoid::Relations::Builders::Referenced::In, Mongoid::Relations::Builders::Referenced::Many, Mongoid::Relations::Builders::Referenced::ManyToMany, Mongoid::Relations::Builders::Referenced::One

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Builder) initialize(base, metadata, object)

Instantiate the new builder for a relation.

Examples:

Create the builder.

Builder.new(metadata, { :field => "value })

Since:

  • 2.0.0.rc.1



24
25
26
# File 'lib/mongoid/relations/builder.rb', line 24

def initialize(base, , object)
  @base, @metadata, @object = base, , object
end

Instance Attribute Details

- (Object) base (readonly)

Returns the value of attribute base



11
12
13
# File 'lib/mongoid/relations/builder.rb', line 11

def base
  @base
end

- (Object) metadata (readonly)

Returns the value of attribute metadata



11
12
13
# File 'lib/mongoid/relations/builder.rb', line 11

def 
  @metadata
end

- (Object) object (readonly)

Returns the value of attribute object



11
12
13
# File 'lib/mongoid/relations/builder.rb', line 11

def object
  @object
end