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

43 lines
637 B
Ruby
Raw Normal View History

2010-11-29 17:38:45 -05:00
module Arel
module Nodes
class Unary < Arel::Nodes::Node
attr_accessor :expr
2010-12-14 23:53:19 -05:00
alias :value :expr
2010-11-29 17:38:45 -05:00
def initialize expr
2013-05-17 18:43:54 -04:00
super()
2010-11-29 17:38:45 -05:00
@expr = expr
end
def hash
@expr.hash
end
def eql? other
self.class == other.class &&
self.expr == other.expr
end
alias :== :eql?
2010-11-29 17:38:45 -05:00
end
2010-12-14 23:53:19 -05:00
%w{
Bin
Cube
DistinctOn
2010-12-14 23:53:19 -05:00
Group
GroupingElement
GroupingSet
Limit
Lock
Not
Offset
2010-12-14 23:53:19 -05:00
On
Ordering
RollUp
Top
2010-12-14 23:53:19 -05:00
}.each do |name|
const_set(name, Class.new(Unary))
end
2010-11-29 17:38:45 -05:00
end
end