aboutsummaryrefslogblamecommitdiffstats
path: root/lib/arel/engines/memory/primitives.rb
blob: 935b34f5ee4907cd8efbfec243c7ba790583893e (plain) (tree)
1
2
3
4
5
6
7





                 
 




                 
 




                                                                 
 


                             
 


                            
   
module Arel
  class Attribute
    def eval(row)
      row[self]
    end
  end

  class Value
    def eval(row)
      value
    end
  end

  class Ordering
    def eval(row1, row2)
      (attribute.eval(row1) <=> attribute.eval(row2)) * direction
    end
  end

  class Descending < Ordering
    def direction; -1 end
  end

  class Ascending < Ordering
    def direction; 1 end
  end
end