Sha256: 4d77c67b8d813288703ef4589d3dadbe12c18ee640de4d58b4fe9ea0e96ca3ee

Contents?: true

Size: 777 Bytes

Versions: 4

Compression:

Stored size: 777 Bytes

Contents

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

module Arel
  module Nodes
    # https://www.postgresql.org/docs/9.5/sql-insert.html
    class Infer < Arel::Nodes::Binary
      alias name left
      alias indexes right
    end
  end

  module Visitors
    class ToSql
      def visit_Arel_Nodes_Infer(o, collector)
        if o.name.present?
          collector << 'ON CONSTRAINT '
          collector << o.left
          collector << ' '
        end

        if o.right.present?
          collector << '('
          inject_join o.right, collector, ', '
          collector << ') '
        end

        collector
      end
    end
  end
end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
arel_toolkit-0.4.9 lib/arel/extensions/infer.rb
arel_toolkit-0.4.8 lib/arel/extensions/infer.rb
arel_toolkit-0.4.7 lib/arel/extensions/infer.rb
arel_toolkit-0.4.6 lib/arel/extensions/infer.rb