Class: ActiveForce::Association::EagerLoadProjectionBuilder
- Inherits:
-
Object
- Object
- ActiveForce::Association::EagerLoadProjectionBuilder
- Defined in:
- lib/active_force/association/eager_load_projection_builder.rb
Instance Attribute Summary collapse
-
#association ⇒ Object
readonly
Returns the value of attribute association.
-
#parent_association_field ⇒ Object
readonly
Returns the value of attribute parent_association_field.
-
#query_fields ⇒ Object
readonly
Returns the value of attribute query_fields.
Class Method Summary collapse
- .build(association, parent_association_field = nil, query_fields = nil) ⇒ Object
- .projection_builder_class(association) ⇒ Object
Instance Method Summary collapse
-
#initialize(association, parent_association_field = nil, query_fields = nil) ⇒ EagerLoadProjectionBuilder
constructor
A new instance of EagerLoadProjectionBuilder.
- #projections ⇒ Object
Constructor Details
#initialize(association, parent_association_field = nil, query_fields = nil) ⇒ EagerLoadProjectionBuilder
Returns a new instance of EagerLoadProjectionBuilder.
20 21 22 23 24 |
# File 'lib/active_force/association/eager_load_projection_builder.rb', line 20 def initialize(association, parent_association_field = nil, query_fields = nil) @association = association @parent_association_field = parent_association_field @query_fields = query_fields end |
Instance Attribute Details
#association ⇒ Object (readonly)
Returns the value of attribute association.
18 19 20 |
# File 'lib/active_force/association/eager_load_projection_builder.rb', line 18 def association @association end |
#parent_association_field ⇒ Object (readonly)
Returns the value of attribute parent_association_field.
18 19 20 |
# File 'lib/active_force/association/eager_load_projection_builder.rb', line 18 def parent_association_field @parent_association_field end |
#query_fields ⇒ Object (readonly)
Returns the value of attribute query_fields.
18 19 20 |
# File 'lib/active_force/association/eager_load_projection_builder.rb', line 18 def query_fields @query_fields end |
Class Method Details
.build(association, parent_association_field = nil, query_fields = nil) ⇒ Object
6 7 8 |
# File 'lib/active_force/association/eager_load_projection_builder.rb', line 6 def build(association, parent_association_field = nil, query_fields = nil) new(association, parent_association_field, query_fields).projections end |
.projection_builder_class(association) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/active_force/association/eager_load_projection_builder.rb', line 10 def projection_builder_class(association) klass = association.class.name.demodulize ActiveForce::Association.const_get "#{klass}ProjectionBuilder" rescue NameError raise "No projection builder exists for #{klass}" end |
Instance Method Details
#projections ⇒ Object
26 27 28 29 |
# File 'lib/active_force/association/eager_load_projection_builder.rb', line 26 def projections builder_class = self.class.projection_builder_class(association) builder_class.new(association, parent_association_field, query_fields).projections end |