Sha256: 81de67d75939bc7b3b872162f0e3a31589b8421ec3c97530b6f99552a2cb9978

Contents?: true

Size: 838 Bytes

Versions: 2

Compression:

Stored size: 838 Bytes

Contents

require 'active_record' unless defined? ActiveRecord
require_relative 'seek_party/seek_party_attribute'
require_relative 'seek_party/seek_party_engine'
require_relative 'seek_party/seek_party_query'
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

2 entries across 2 versions & 1 rubygems

Version Path
seek_party-0.0.2 lib/seek_party.rb
seek_party-0.0.1 lib/seek_party.rb