Sha256: 5c535dc0e99997696a4917f359029eef3ef1f674237d6d88ba0eb8deff6f63ee

Contents?: true

Size: 796 Bytes

Versions: 10

Compression:

Stored size: 796 Bytes

Contents

# rubocop:disable Naming/MethodName
# rubocop:disable Naming/UncommunicativeMethodParamName

module Arel
  if Gem.loaded_specs.key?('postgres_ext')
    module Visitors
      module ContainsPatch
        def visit_Arel_Nodes_Contains(o, collector)
          if o.left.is_a?(Arel::Attribute)
            super
          else
            infix_value o, collector, ' @> '
          end
        end
      end

      PostgreSQL.prepend(ContainsPatch)
    end
  else
    module Nodes
      # https://www.postgresql.org/docs/9.1/functions-array.html
      class Contains < Arel::Nodes::InfixOperation
        def initialize(left, right)
          super(:'@>', left, right)
        end
      end
    end
  end
end

# rubocop:enable Naming/MethodName
# rubocop:enable Naming/UncommunicativeMethodParamName

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
arel_toolkit-0.4.9 lib/arel/extensions/contains.rb
arel_toolkit-0.4.8 lib/arel/extensions/contains.rb
arel_toolkit-0.4.7 lib/arel/extensions/contains.rb
arel_toolkit-0.4.6 lib/arel/extensions/contains.rb
arel_toolkit-0.4.5 lib/arel/extensions/contains.rb
arel_toolkit-0.4.4 lib/arel/extensions/contains.rb
arel_toolkit-0.4.3 lib/arel/extensions/contains.rb
arel_toolkit-0.4.2 lib/arel/extensions/contains.rb
arel_toolkit-0.4.1 lib/arel/extensions/contains.rb
arel_toolkit-0.4.0 lib/arel/extensions/contains.rb