Sha256: 3cce6a3fb7969b518617152d512bce8ac01929f459627149ffa2ed49f11f89cc

Contents?: true

Size: 942 Bytes

Versions: 3

Compression:

Stored size: 942 Bytes

Contents

require 'active_record' unless defined? ActiveRecord
require_relative 'seek_party/models/sp_attribute'
require_relative 'seek_party/models/sp_query'
require_relative 'seek_party/seek_party_attribute'
require_relative 'seek_party/seek_party_engine'
require_relative 'seek_party/seek_party_query_builder'
require_relative 'seek_party/version'

module SeekParty
  DEFAULT_BLACK_LIST = %w[id created_at updated_at].freeze

  # Method below triggers all the magic
  def search(params: [],
             black_list: DEFAULT_BLACK_LIST,
             white_list: nil,
             scopes: [])
    # If there are params to work with, use SeekParty.
    # Otherwise, just return an empty instance of ActiveRecord_Relation.
    return none if params.empty?

    SeekPartyEngine
        .new(self,
             params: params,
             white_list: white_list,
             black_list: black_list,
             scopes: scopes)
        .search
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
seek_party-0.0.5 lib/seek_party.rb
seek_party-0.0.4 lib/seek_party.rb
seek_party-0.0.3 lib/seek_party.rb