Sha256: 827c1165ea0c5e2dc13e46a2f142f1ea8e27ae104ef1277a06e3cce0a91461f3

Contents?: true

Size: 565 Bytes

Versions: 2

Compression:

Stored size: 565 Bytes

Contents

require "mobility/util"

module Mobility
  module Backends
    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
        def initialize(attributes, _)
          @attributes = attributes.map!(&:to_sym)
        end

        def extract_attributes(cond)
          cond.is_a?(Hash) && Util.presence(cond.keys & @attributes)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mobility-0.4.1 lib/mobility/backends/sequel/query_methods.rb
mobility-0.4.0 lib/mobility/backends/sequel/query_methods.rb