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
|
|
|
|
@expr = expr
|
|
|
|
end
|
2012-08-18 22:33:25 -04:00
|
|
|
|
|
|
|
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{
|
2011-04-11 13:02:28 -04:00
|
|
|
Bin
|
2010-12-14 23:53:19 -05:00
|
|
|
Group
|
|
|
|
Having
|
2011-01-03 13:31:25 -05:00
|
|
|
Limit
|
|
|
|
Not
|
|
|
|
Offset
|
2010-12-14 23:53:19 -05:00
|
|
|
On
|
2011-06-14 17:43:22 -04:00
|
|
|
Ordering
|
2011-01-03 13:31:25 -05:00
|
|
|
Top
|
2011-02-21 18:14:29 -05:00
|
|
|
Lock
|
2011-04-21 16:46:24 -04:00
|
|
|
DistinctOn
|
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
|