Sha256: 30b176273864ac5b442d97798d5b2233a002a340bb812f454bfa83574aba726e

Contents?: true

Size: 759 Bytes

Versions: 3

Compression:

Stored size: 759 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 << ' '
        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.5 lib/arel/extensions/infer.rb
arel_toolkit-0.4.4 lib/arel/extensions/infer.rb
arel_toolkit-0.4.3 lib/arel/extensions/infer.rb