Sha256: fd0c51aebcf8e6bbcd916151a14cca2ac01cd23cde95120167c56834958440a9

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

require "active_record/scope_names"
require "active_hash_relation/version"
require "active_hash_relation/helpers"
require "active_hash_relation/column_filters"
require "active_hash_relation/scope_filters"
require "active_hash_relation/sort_filters"
require "active_hash_relation/limit_filters"
require "active_hash_relation/association_filters"
require "active_hash_relation/filter_applier"

require "active_hash_relation/aggregation"

module ActiveHashRelation
  class << self
    attr_accessor :configuration
  end

  def self.configure
    self.configuration
    yield(configuration)
  end

  def self.configuration
    @configuration ||= Configuration.new do
      self.has_filter_classes = false
    end
  end

  def apply_filters(resource, params, include_associations: false, model: nil)
    FilterApplier.new(
      resource,
      params,
      include_associations: include_associations,
      model: model
    ).apply_filters
  end

  def aggregations(resource, params, model: nil)
    Aggregation.new(resource, params, model: model).apply
  end

  class Configuration
    attr_accessor :has_filter_classes, :filter_class_prefix, :filter_class_suffix,
      :use_unscoped
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_hash_relation-1.1.0 lib/active_hash_relation.rb
active_hash_relation-1.0.5 lib/active_hash_relation.rb
active_hash_relation-1.0.4 lib/active_hash_relation.rb