class Arel::TreeManager - arel-4.0.2 Documentation

# class Arel::TreeManager

### Attributes

ast[R]
engine[R]

### Public Class Methods

new(engine) click to toggle source

    # File lib/arel/tree_manager.rb, line 7
    def initialize engine
      @engine = engine
      @ctx    = nil
    end

### Public Instance Methods

initialize_copy(other) click to toggle source
Calls superclass method

    # File lib/arel/tree_manager.rb, line 24
    def initialize_copy other
      super
      @ast = @ast.clone
    end

to_dot() click to toggle source

    # File lib/arel/tree_manager.rb, line 12
    def to_dot
      Visitors::Dot.new.accept @ast
    end

to_sql() click to toggle source

    # File lib/arel/tree_manager.rb, line 20
    def to_sql
      visitor.accept @ast
    end

visitor() click to toggle source

    # File lib/arel/tree_manager.rb, line 16
    def visitor
      engine.connection.visitor
    end

where(expr) click to toggle source

    # File lib/arel/tree_manager.rb, line 29
    def where expr
      if Arel::TreeManager === expr
        expr = expr.ast
      end
      @ctx.wheres << expr
      self
    end