Sha256: ad6d77714165b23d96e4fa3cbdb899dd15707e61805abcf962b7f59b4673fa05

Contents?: true

Size: 1.58 KB

Versions: 4

Compression:

Stored size: 1.58 KB

Contents

module Arel
  module Nodes
    class SelectCore < Arel::Nodes::Node
      attr_accessor :top, :projections, :wheres, :groups, :windows
      attr_accessor :having, :source, :set_quantifier

      def initialize
        @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
        @windows        = []
      end

      def from
        @source.left
      end

      def from= value
        @source.left = value
      end

      alias :froms= :from=
      alias :froms :from

      def initialize_copy other
        super
        @source      = @source.clone if @source
        @projections = @projections.clone
        @wheres      = @wheres.clone
        @groups      = @groups.clone
        @having      = @having.clone if @having
        @windows     = @windows.clone
      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?
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
challah-1.0.0 vendor/bundle/gems/arel-4.0.0/lib/arel/nodes/select_core.rb
arel-4.0.0 lib/arel/nodes/select_core.rb
arel-4.0.0.beta2 lib/arel/nodes/select_core.rb
arel-4.0.0.beta1 lib/arel/nodes/select_core.rb