Sha256: e714dc305248cffc6eedac5bdbfc1695a313ce8a623c17aaa8ce55daa57ec989

Contents?: true

Size: 761 Bytes

Versions: 3

Compression:

Stored size: 761 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
          collector << 'ON CONSTRAINT '
          collector << o.left
          collector << SPACE
        end

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

        collector
      end
    end
  end
end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arel_toolkit-0.4.2 lib/arel/extensions/infer.rb
arel_toolkit-0.4.1 lib/arel/extensions/infer.rb
arel_toolkit-0.4.0 lib/arel/extensions/infer.rb