Sha256: 6037f5697e80697810e154d9077059fc793bccd5637f7f66e0313a1e8ace68ee

Contents?: true

Size: 770 Bytes

Versions: 2

Compression:

Stored size: 770 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::Node
      attr_accessor :name
      attr_accessor :indexes
    end
  end

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

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

        collector
      end
    end
  end
end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arel_toolkit-0.3.0 lib/arel/extensions/infer.rb
arel_toolkit-0.2.0 lib/arel/extensions/infer.rb