Sha256: 009a00b5105e0da349ae34e05e7446e861a469423998589b7eb266efd6d92176

Contents?: true

Size: 599 Bytes

Versions: 2

Compression:

Stored size: 599 Bytes

Contents

module Mobility
  module Backend
    module Sequel
=begin

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

=end
      class QueryMethods < Module
        # @param [Array<String>] attributes Translated attributes
        # @param [Hash] options Backend options
        def initialize(attributes, **)
          @attributes = attributes.map! &:to_sym
          @attributes_extractor = lambda do |cond|
            cond.is_a?(Hash) && (cond.keys & attributes).presence
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mobility-0.1.5 lib/mobility/backend/sequel/query_methods.rb
mobility-0.1.4 lib/mobility/backend/sequel/query_methods.rb