1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/lib/arel/nodes/unary.rb

42 lines
637 B
Ruby

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
Cube
DistinctOn
Group
GroupingElement
GroupingSet
Limit
Lock
Not
Offset
On
Ordering
RollUp
Top
}.each do |name|
const_set(name, Class.new(Unary))
end
end
end