Class: ActiveRecord::Aggregations::AggregationReflection

Inherits:
Object
  • Object
show all
Defined in:
lib/reactive_record/active_record/aggregations.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner_class, macro, name, options = {}) ⇒ AggregationReflection

Returns a new instance of AggregationReflection.



22
23
24
25
26
27
# File 'lib/reactive_record/active_record/aggregations.rb', line 22

def initialize(owner_class, macro, name, options = {})
  owner_class.reflect_on_all_aggregations << self
  @owner_class = owner_class
  @klass_name =  options[:class_name] || name.camelize
  @attribute =   name
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



20
21
22
# File 'lib/reactive_record/active_record/aggregations.rb', line 20

def attribute
  @attribute
end

#klass_nameObject (readonly)

Returns the value of attribute klass_name.



19
20
21
# File 'lib/reactive_record/active_record/aggregations.rb', line 19

def klass_name
  @klass_name
end

Instance Method Details

#klassObject



29
30
31
# File 'lib/reactive_record/active_record/aggregations.rb', line 29

def klass
  @klass ||= Object.const_get(@klass_name)
end