Sha256: f2dcba37d392ea4385c630236e4dc667572ea4588ed3ac78cf5cac5ffeb6f994

Contents?: true

Size: 583 Bytes

Versions: 7

Compression:

Stored size: 583 Bytes

Contents

# frozen_string_literal: true

module Lcms
  module Engine
    class BaseQuery
      def self.call(query, pagination = nil)
        new(query, pagination).call
      end

      # query : query params (Hash or OpenStruct)
      # pagination : pagination params, if pagination is nil whe return all results
      def initialize(query, pagination = nil)
        @q = OpenStruct.new(query)
        @pagination = pagination
      end

      # Returns: ActiveRecord relation
      def call
        raise NotImplementedError
      end

      private

      attr_reader :q
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lcms-engine-0.3.1 app/queries/lcms/engine/base_query.rb
lcms-engine-0.1.4 app/queries/lcms/engine/base_query.rb
lcms-engine-0.3.0 app/queries/lcms/engine/base_query.rb
lcms-engine-0.1.3 app/queries/lcms/engine/base_query.rb
lcms-engine-0.2.0 app/queries/lcms/engine/base_query.rb
lcms-engine-0.1.2 app/queries/lcms/engine/base_query.rb
lcms-engine-0.1.0 app/queries/lcms/engine/base_query.rb