Class: ActiveForce::Association::EagerLoadProjectionBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/active_force/association/eager_load_projection_builder.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(association) ⇒ EagerLoadProjectionBuilder

Returns a new instance of EagerLoadProjectionBuilder.



12
13
14
# File 'lib/active_force/association/eager_load_projection_builder.rb', line 12

def initialize(association)
  @association = association
end

Instance Attribute Details

#associationObject (readonly)

Returns the value of attribute association.



10
11
12
# File 'lib/active_force/association/eager_load_projection_builder.rb', line 10

def association
  @association
end

Class Method Details

.build(association) ⇒ Object



5
6
7
# File 'lib/active_force/association/eager_load_projection_builder.rb', line 5

def build(association)
  new(association).projections
end

Instance Method Details

#projectionsObject



16
17
18
19
20
21
22
# File 'lib/active_force/association/eager_load_projection_builder.rb', line 16

def projections
  klass = association.class.name.split('::').last
  builder_class = ActiveForce::Association.const_get "#{klass}ProjectionBuilder"
  builder_class.new(association).projections
rescue NameError
  raise "Don't know how to build projections for #{klass}"
end