aboutsummaryrefslogblamecommitdiffstats
path: root/lib/arel/nodes/unary.rb
blob: 3d4a4b014a900453eb4068e1da22fa6272c08712 (plain) (tree)
1
2
3
4
5
6
7
8
9
10



                                   
                        

                         
               

                    









                                    
       

       
         
           
            


            
        
              
         
          
                


                                       

     
module Arel
  module Nodes
    class Unary < Arel::Nodes::Node
      attr_accessor :expr
      alias :value :expr

      def initialize expr
        super()
        @expr = expr
      end

      def hash
        @expr.hash
      end

      def eql? other
        self.class == other.class &&
          self.expr == other.expr
      end
      alias :== :eql?
    end

    %w{
      Bin
      Group
      Having
      Limit
      Not
      Offset
      On
      Ordering
      Top
      Lock
      DistinctOn
    }.each do |name|
      const_set(name, Class.new(Unary))
    end
  end
end