Class: Lcms::Engine::BaseQuery

Inherits:
Object
  • Object
show all
Defined in:
app/queries/lcms/engine/base_query.rb

Direct Known Subclasses

AdminDocumentsQuery, AdminMaterialsQuery

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query, pagination = nil) ⇒ BaseQuery

query : query params (Hash or OpenStruct) pagination : pagination params, if pagination is nil whe return all results



12
13
14
15
# File 'app/queries/lcms/engine/base_query.rb', line 12

def initialize(query, pagination = nil)
  @q = OpenStruct.new(query) # rubocop:disable Style/OpenStructUse
  @pagination = pagination
end

Class Method Details

.call(query, pagination = nil) ⇒ Object



6
7
8
# File 'app/queries/lcms/engine/base_query.rb', line 6

def self.call(query, pagination = nil)
  new(query, pagination).call
end

Instance Method Details

#callObject

Returns: ActiveRecord relation

Raises:

  • (NotImplementedError)


18
19
20
# File 'app/queries/lcms/engine/base_query.rb', line 18

def call
  raise NotImplementedError
end