Sha256: 5775ae200ab4624bec5132c47d99cca972b4b49d5f75bd8ed2c9b3373e835f77

Contents?: true

Size: 1.78 KB

Versions: 73

Compression:

Stored size: 1.78 KB

Contents

# frozen_string_literal: true

module Arel # :nodoc: all
  module Nodes
    class SelectCore < Arel::Nodes::Node
      attr_accessor :projections, :wheres, :groups, :windows, :comment
      attr_accessor :havings, :source, :set_quantifier, :optimizer_hints

      def initialize
        super()
        @source = JoinSource.new nil

        # https://ronsavage.github.io/SQL/sql-92.bnf.html#set%20quantifier
        @set_quantifier  = nil
        @optimizer_hints = nil
        @projections     = []
        @wheres          = []
        @groups          = []
        @havings         = []
        @windows         = []
        @comment         = nil
      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
        @havings     = @havings.clone
        @windows     = @windows.clone
      end

      def hash
        [
          @source, @set_quantifier, @projections, @optimizer_hints,
          @wheres, @groups, @havings, @windows, @comment
        ].hash
      end

      def eql?(other)
        self.class == other.class &&
          self.source == other.source &&
          self.set_quantifier == other.set_quantifier &&
          self.optimizer_hints == other.optimizer_hints &&
          self.projections == other.projections &&
          self.wheres == other.wheres &&
          self.groups == other.groups &&
          self.havings == other.havings &&
          self.windows == other.windows &&
          self.comment == other.comment
      end
      alias :== :eql?
    end
  end
end

Version data entries

73 entries across 73 versions & 7 rubygems

Version Path
activerecord-6.1.7.10 lib/arel/nodes/select_core.rb
activerecord-6.1.7.9 lib/arel/nodes/select_core.rb
activerecord-6.1.7.8 lib/arel/nodes/select_core.rb
activerecord-6.1.7.7 lib/arel/nodes/select_core.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/arel/nodes/select_core.rb
activerecord-6.1.7.6 lib/arel/nodes/select_core.rb
activerecord-6.1.7.5 lib/arel/nodes/select_core.rb
activerecord-6.1.7.4 lib/arel/nodes/select_core.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/arel/nodes/select_core.rb
activerecord-6.1.7.3 lib/arel/nodes/select_core.rb
activerecord-6.1.7.2 lib/arel/nodes/select_core.rb
activerecord-6.1.7.1 lib/arel/nodes/select_core.rb
activerecord-6.0.6.1 lib/arel/nodes/select_core.rb
activerecord-6.1.7 lib/arel/nodes/select_core.rb
activerecord-6.0.6 lib/arel/nodes/select_core.rb
activerecord-6.1.6.1 lib/arel/nodes/select_core.rb
activerecord-6.0.5.1 lib/arel/nodes/select_core.rb
activerecord-6.0.5 lib/arel/nodes/select_core.rb
activerecord-6.1.6 lib/arel/nodes/select_core.rb
activerecord-6.1.5.1 lib/arel/nodes/select_core.rb