aboutsummaryrefslogblamecommitdiffstats
path: root/lib/arel/algebra/relations/utilities/externalization.rb
blob: edd8f99221c85f9fa180ca65b2e7c595e40c009f (plain) (tree)
1
2
3
4
5
6
7
8
9
           
                                  

                             
 
              

        
 
                  
                                                                                      
       
     
 
                 
                   
                                                                         
       
 
                       
           

       
   
module Arel
  class Externalization < Compound
    attributes :relation
    deriving :initialize, :==

    def wheres
      []
    end

    def attributes
      @attributes ||= Header.new(relation.attributes.map { |a| a.to_attribute(self) })
    end
  end

  module Relation
    def externalize
      @externalized ||= externalizable?? Externalization.new(self) : self
    end

    def externalizable?
      false
    end
  end
end