Sha256: 0d7ac9600ef418b64a8978f43e521ad66ae2c4575bf37410b553ab9d6db256e9

Contents?: true

Size: 761 Bytes

Versions: 9

Compression:

Stored size: 761 Bytes

Contents

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

module Arel
  module Nodes
    # Postgres: https://www.postgresql.org/docs/9.4/sql-select.html
    class RangeFunction < Arel::Nodes::Unary
      attr_reader :is_rowsfrom

      def initialize(*args, is_rowsfrom:, **kwargs)
        @is_rowsfrom = is_rowsfrom
        super(*args, **kwargs)
      end
    end
  end

  module Visitors
    class ToSql
      def visit_Arel_Nodes_RangeFunction(o, collector)
        collector << 'ROWS FROM (' if o.is_rowsfrom
        visit o.expr, collector
        collector << ')' if o.is_rowsfrom

        collector
      end
    end
  end
end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
arel_toolkit-0.4.9 lib/arel/extensions/range_function.rb
arel_toolkit-0.4.8 lib/arel/extensions/range_function.rb
arel_toolkit-0.4.7 lib/arel/extensions/range_function.rb
arel_toolkit-0.4.6 lib/arel/extensions/range_function.rb
arel_toolkit-0.4.5 lib/arel/extensions/range_function.rb
arel_toolkit-0.4.4 lib/arel/extensions/range_function.rb
arel_toolkit-0.4.3 lib/arel/extensions/range_function.rb
arel_toolkit-0.4.2 lib/arel/extensions/range_function.rb
arel_toolkit-0.4.1 lib/arel/extensions/range_function.rb