Class: Mobility::Backend::Sequel::QueryMethods

Inherits:
Module
  • Object
show all
Defined in:
lib/mobility/backend/sequel/query_methods.rb

Overview

Defines query method overrides to handle translated attributes for Sequel models. For details see backend-specific subclasses.

Instance Method Summary collapse

Constructor Details

#initialize(attributes, **options) ⇒ QueryMethods

Returns a new instance of QueryMethods.

Parameters:

  • attributes (Array<String>)

    Translated attributes

  • options (Hash)

    Backend options



13
14
15
16
17
18
# File 'lib/mobility/backend/sequel/query_methods.rb', line 13

def initialize(attributes, **options)
  @attributes = attributes.map! &:to_sym
  @attributes_extractor = lambda do |cond|
    cond.is_a?(Hash) && (cond.keys & attributes).presence
  end
end