aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/from_clause.rb
blob: ea838b79a6e03a2de4044a121cc2bdd193802370 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true
module ActiveRecord
  class Relation
    class FromClause # :nodoc:
      attr_reader :value, :name

      def initialize(value, name)
        @value = value
        @name = name
      end

      def binds
        if value.is_a?(Relation)
          value.bound_attributes
        else
          []
        end
      end

      def merge(other)
        self
      end

      def empty?
        value.nil?
      end

      def self.empty
        @empty ||= new(nil, nil)
      end
    end
  end
end