Sha256: d9473792822214f9f1a1e5700e310f998ca8758e8cf216cb801faf20ddfc8029

Contents?: true

Size: 878 Bytes

Versions: 12

Compression:

Stored size: 878 Bytes

Contents

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

module Arel
  module Nodes
    # https://github.com/mvgijssel/arel_toolkit/issues/46
    class Lateral < Arel::Nodes::Unary
    end
  end

  module Visitors
    class ToSql
      # https://github.com/mvgijssel/arel_toolkit/issues/46
      def visit_Arel_Nodes_Lateral(o, collector)
        collector << 'LATERAL '
        grouping_parentheses o, collector
      end

      # https://github.com/mvgijssel/arel_toolkit/issues/46
      def grouping_parentheses(o, collector)
        if o.expr.is_a? Nodes::SelectStatement
          collector << '('
          visit o.expr, collector
          collector << ')'
        else
          visit o.expr, collector
        end
      end
    end
  end
end

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

Version data entries

12 entries across 12 versions & 1 rubygems

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