aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/lib/arel/collectors/substitute_binds.rb
blob: 4b894bc4b1a5e36a3af46b6d15b6c1f08e1b2b3b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                             
 
                         
                   
                         


                                                

         
                 
                       


            
                        
                                  

         

                      
         
 
             
                                      


       
# frozen_string_literal: true

module Arel # :nodoc: all
  module Collectors
    class SubstituteBinds
      def initialize(quoter, delegate_collector)
        @quoter = quoter
        @delegate = delegate_collector
      end

      def <<(str)
        delegate << str
        self
      end

      def add_bind(bind)
        self << quoter.quote(bind)
      end

      def value
        delegate.value
      end

      private
        attr_reader :quoter, :delegate
    end
  end
end