Sha256: fe683adc948b11705b12b1a6fa7130c4b860a83ce3ebf36bb67e86fdd27a1fc0

Contents?: true

Size: 803 Bytes

Versions: 8

Compression:

Stored size: 803 Bytes

Contents

# frozen_string_literal: true
require "mobility/backends/sequel/query_methods"

module Mobility
  module Backends
    module Sequel
      class Column::QueryMethods < QueryMethods
        def initialize(attributes, _)
          super
          q = self

          %w[exclude or where].each do |method_name|
            define_method method_name do |*conds, &block|
              if i18n_keys = q.extract_attributes(conds.first)
                cond = conds.first.dup
                i18n_keys.each do |attr|
                  cond[Backends::Column.column_name_for(attr)] = q.collapse cond.delete(attr)
                end
                super(cond, &block)
              else
                super(*conds, &block)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mobility-0.7.6 lib/mobility/backends/sequel/column/query_methods.rb
mobility-0.7.5 lib/mobility/backends/sequel/column/query_methods.rb
mobility-0.7.4 lib/mobility/backends/sequel/column/query_methods.rb
mobility-0.7.3 lib/mobility/backends/sequel/column/query_methods.rb
mobility-0.7.2 lib/mobility/backends/sequel/column/query_methods.rb
mobility-0.7.1 lib/mobility/backends/sequel/column/query_methods.rb
mobility-0.7.0 lib/mobility/backends/sequel/column/query_methods.rb
mobility-0.6.0 lib/mobility/backends/sequel/column/query_methods.rb