Sha256: 6962974e39d7185a71699c46ddef0328f34ea886c21a548d820d3f2830ee44d9

Contents?: true

Size: 964 Bytes

Versions: 3

Compression:

Stored size: 964 Bytes

Contents

require 'arel'
require 'active_support/core_ext'

module WeightedAverage
  DEFAULT_WEIGHTED_BY_COLUMN_NAME = :weighting
end

require 'weighted_average/arel_select_manager_instance_methods'
Arel::SelectManager.send :include, WeightedAverage::ArelSelectManagerInstanceMethods

require 'weighted_average/arel_table_instance_methods'
Arel::Table.send :include, WeightedAverage::ArelTableInstanceMethods

if defined?(ActiveRecord)
  require 'weighted_average/active_record_base_class_methods'
  ActiveRecord::Base.extend WeightedAverage::ActiveRecordBaseClassMethods
  proxy_class = defined?(ActiveRecord::Associations::CollectionProxy) ? ActiveRecord::Associations::CollectionProxy : ActiveRecord::Associations::AssociationCollection
  proxy_class.extend WeightedAverage::ActiveRecordBaseClassMethods

  require 'weighted_average/active_record_relation_instance_methods'
  ActiveRecord::Relation.send :include, WeightedAverage::ActiveRecordRelationInstanceMethods
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
weighted_average-2.0.2 lib/weighted_average.rb
weighted_average-2.0.1 lib/weighted_average.rb
weighted_average-2.0.0 lib/weighted_average.rb