123456789_123456789_123456789_123456789_123456789_

Class: Arel::TreeManager

Do not use. This class is for internal use only.
Relationships & Source Files
Namespace Children
Modules:
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
Inherits: Object
Defined in: activerecord/lib/arel/tree_manager.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(table = nil) ⇒ TreeManager

[ GitHub ]

  
# File 'activerecord/lib/arel/tree_manager.rb', line 47

def initialize(table = nil)
  @table = table
end

Instance Attribute Details

#ast (readonly)

[ GitHub ]

  
# File 'activerecord/lib/arel/tree_manager.rb', line 45

attr_reader :ast

Instance Method Details

#initialize_copy(other)

[ GitHub ]

  
# File 'activerecord/lib/arel/tree_manager.rb', line 70

def initialize_copy(other)
  super
  @ast = @ast.clone
end

#to_dot

[ GitHub ]

  
# File 'activerecord/lib/arel/tree_manager.rb', line 51

def to_dot
  collector = Arel::Collectors::PlainString.new
  collector = Visitors::Dot.new.accept @ast, collector
  collector.value
end

#to_sql(engine = nil)

[ GitHub ]

  
# File 'activerecord/lib/arel/tree_manager.rb', line 57

def to_sql(engine = nil)
  unless engine
    table = @table.is_a?(Nodes::JoinSource) ? @table.left : @table

    engine = table&.klass || Table.engine
  end

  collector = Arel::Collectors::SQLString.new
  engine.with_connection do |connection|
    connection.visitor.accept(@ast, collector).value
  end
end