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/select_core.rb

64 lines
1.6 KiB
Ruby
Raw Normal View History

2010-08-12 19:19:54 -04:00
module Arel
module Nodes
2010-11-29 18:23:58 -05:00
class SelectCore < Arel::Nodes::Node
2012-02-22 09:25:10 -05:00
attr_accessor :top, :projections, :wheres, :groups, :windows
2011-04-21 16:28:21 -04:00
attr_accessor :having, :source, :set_quantifier
2010-12-07 17:20:30 -05:00
2010-08-12 19:19:54 -04:00
def initialize
2013-05-17 18:43:54 -04:00
super()
2011-04-21 16:28:21 -04:00
@source = JoinSource.new nil
@top = nil
# http://savage.net.au/SQL/sql-92.bnf.html#set%20quantifier
@set_quantifier = nil
@projections = []
@wheres = []
@groups = []
@having = nil
2012-02-22 09:25:10 -05:00
@windows = []
2010-08-12 19:19:54 -04:00
end
2010-08-19 01:30:36 -04:00
2010-12-14 12:43:19 -05:00
def from
@source.left
end
def from= value
@source.left = value
end
alias :froms= :from=
alias :froms :from
2010-08-19 01:30:36 -04:00
def initialize_copy other
super
2010-12-14 12:43:19 -05:00
@source = @source.clone if @source
@projections = @projections.clone
2010-09-07 18:47:38 -04:00
@wheres = @wheres.clone
2010-12-21 13:51:28 -05:00
@groups = @groups.clone
2010-09-08 18:29:22 -04:00
@having = @having.clone if @having
2012-02-22 09:25:10 -05:00
@windows = @windows.clone
2010-08-19 01:30:36 -04:00
end
def hash
[
@source, @top, @set_quantifier, @projections,
@wheres, @groups, @having, @windows
].hash
end
def eql? other
self.class == other.class &&
self.source == other.source &&
self.top == other.top &&
self.set_quantifier == other.set_quantifier &&
self.projections == other.projections &&
self.wheres == other.wheres &&
self.groups == other.groups &&
self.having == other.having &&
self.windows == other.windows
end
alias :== :eql?
2010-08-12 19:19:54 -04:00
end
end
end