Sha256: 7138c2a64c917ba1e0e17aa5e12038d31a0326495ca8d618e95de35170ad1e53

Contents?: true

Size: 824 Bytes

Versions: 5

Compression:

Stored size: 824 Bytes

Contents

module Alf
  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 obc = sexpr.order_by_clause
            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 Alf

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-sql-0.16.3 lib/alf/sql/processor/order_by.rb
alf-sql-0.16.2 lib/alf/sql/processor/order_by.rb
alf-sql-0.16.1 lib/alf/sql/processor/order_by.rb
alf-sql-0.16.0 lib/alf/sql/processor/order_by.rb
alf-sql-0.15.0 lib/alf/sql/processor/order_by.rb