Sha256: 4fe3262181a05f0b2e3252e924cc28ab81c00f398b58daec1fe05bf0cfb4648d

Contents?: true

Size: 831 Bytes

Versions: 12

Compression:

Stored size: 831 Bytes

Contents

module Bmg
  module Sql
    class Processor
      class OrderBy < Processor

        def initialize(ordering, builder)
          super(builder)
          @ordering = ordering
        end
        attr_reader :ordering

        def on_set_operator(sexpr)
          call(builder.from_self(sexpr))
        end
        alias :on_union     :on_set_operator
        alias :on_except    :on_set_operator
        alias :on_intersect :on_set_operator

        def on_select_exp(sexpr)
          if sexpr.order_by? || sexpr.group_by?
            sexpr = builder.from_self(sexpr)
            call(sexpr)
          else
            needed = builder.order_by_clause(ordering, &sexpr.desaliaser)
            sexpr.dup.push(needed)
          end
        end

      end # class OrderBy
    end # class Processor
  end # module Sql
end # module Bmg

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
bmg-0.23.3 lib/bmg/sql/processor/order_by.rb
bmg-0.23.2 lib/bmg/sql/processor/order_by.rb
bmg-0.23.1 lib/bmg/sql/processor/order_by.rb
bmg-0.23.0 lib/bmg/sql/processor/order_by.rb
bmg-0.21.5 lib/bmg/sql/processor/order_by.rb
bmg-0.21.4 lib/bmg/sql/processor/order_by.rb
bmg-0.20.5 lib/bmg/sql/processor/order_by.rb
bmg-0.21.3 lib/bmg/sql/processor/order_by.rb
bmg-0.21.2 lib/bmg/sql/processor/order_by.rb
bmg-0.21.0 lib/bmg/sql/processor/order_by.rb
bmg-0.20.4 lib/bmg/sql/processor/order_by.rb
bmg-0.20.2 lib/bmg/sql/processor/order_by.rb