class Arel::Visitors::DepthFirst - arel-4.0.2 Documentation

# class Arel::Visitors::DepthFirst

### Public Class Methods

new(block = nil) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 4
    def initialize block = nil
      @block = block || Proc.new
    end

### Private Instance Methods

binary(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 60
    def binary o, a
      visit o.left, a
      visit o.right, a
    end

Also aliased as: visit_Arel_Nodes_As, visit_Arel_Nodes_Assignment, visit_Arel_Nodes_Between, visit_Arel_Nodes_DeleteStatement, visit_Arel_Nodes_DoesNotMatch, visit_Arel_Nodes_Equality, visit_Arel_Nodes_GreaterThan, visit_Arel_Nodes_GreaterThanOrEqual, visit_Arel_Nodes_In, visit_Arel_Nodes_InfixOperation, visit_Arel_Nodes_JoinSource, visit_Arel_Nodes_InnerJoin, visit_Arel_Nodes_LessThan, visit_Arel_Nodes_LessThanOrEqual, visit_Arel_Nodes_Matches, visit_Arel_Nodes_NotEqual, visit_Arel_Nodes_NotIn, visit_Arel_Nodes_Or, visit_Arel_Nodes_OuterJoin, visit_Arel_Nodes_TableAlias, visit_Arel_Nodes_Values
function(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 31
    def function o, a
      visit o.expressions, a
      visit o.alias, a
      visit o.distinct, a
    end

Also aliased as: visit_Arel_Nodes_Avg, visit_Arel_Nodes_Exists, visit_Arel_Nodes_Max, visit_Arel_Nodes_Min, visit_Arel_Nodes_Sum
nary(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 55
    def nary o, a
      o.children.each { |child| visit child, a }
    end

Also aliased as: visit_Arel_Nodes_And
terminal(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 106
    def terminal o, a
    end

Also aliased as: visit_ActiveSupport_Multibyte_Chars, visit_ActiveSupport_StringInquirer, visit_Arel_Nodes_Lock, visit_Arel_Nodes_Node, visit_Arel_Nodes_SqlLiteral, visit_Arel_Nodes_BindParam, visit_Arel_Nodes_Window, visit_Arel_SqlLiteral, visit_BigDecimal, visit_Bignum, visit_Class, visit_Date, visit_DateTime, visit_FalseClass, visit_Fixnum, visit_Float, visit_NilClass, visit_String, visit_Symbol, visit_Time, visit_TrueClass
unary(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 15
    def unary o, a
      visit o.expr, a
    end

Also aliased as: visit_Arel_Nodes_Group, visit_Arel_Nodes_Grouping, visit_Arel_Nodes_Having, visit_Arel_Nodes_Limit, visit_Arel_Nodes_Not, visit_Arel_Nodes_Offset, visit_Arel_Nodes_On, visit_Arel_Nodes_Ordering, visit_Arel_Nodes_Ascending, visit_Arel_Nodes_Descending, visit_Arel_Nodes_Top, visit_Arel_Nodes_UnqualifiedColumn
visit(o, a = nil) click to toggle source
Calls superclass method Arel::Visitors::Visitor#visit

    # File lib/arel/visitors/depth_first.rb, line 10
    def visit o, a = nil
      super
      @block.call o
    end

visit_ActiveSupport_Multibyte_Chars(o, a)
Alias for: terminal
visit_ActiveSupport_StringInquirer(o, a)
Alias for: terminal
visit_Arel_Attribute(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 90
    def visit_Arel_Attribute o, a
      visit o.relation, a
      visit o.name, a
    end

Also aliased as: visit_Arel_Attributes_Integer, visit_Arel_Attributes_Float, visit_Arel_Attributes_String, visit_Arel_Attributes_Time, visit_Arel_Attributes_Boolean, visit_Arel_Attributes_Attribute, visit_Arel_Attributes_Decimal
visit_Arel_Attributes_Attribute(o, a)
Alias for: visit_Arel_Attribute
visit_Arel_Attributes_Boolean(o, a)
Alias for: visit_Arel_Attribute
visit_Arel_Attributes_Decimal(o, a)
Alias for: visit_Arel_Attribute
visit_Arel_Attributes_Float(o, a)
Alias for: visit_Arel_Attribute
visit_Arel_Attributes_Integer(o, a)
Alias for: visit_Arel_Attribute
visit_Arel_Attributes_String(o, a)
Alias for: visit_Arel_Attribute
visit_Arel_Attributes_Time(o, a)
Alias for: visit_Arel_Attribute
visit_Arel_Nodes_And(o, a)
Alias for: nary
visit_Arel_Nodes_As(o, a)
Alias for: binary
visit_Arel_Nodes_Ascending(o, a)
Alias for: unary
visit_Arel_Nodes_Assignment(o, a)
Alias for: binary
visit_Arel_Nodes_Avg(o, a)
Alias for: function
visit_Arel_Nodes_Between(o, a)
Alias for: binary
visit_Arel_Nodes_BindParam(o, a)
Alias for: terminal
visit_Arel_Nodes_Count(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 49
    def visit_Arel_Nodes_Count o, a
      visit o.expressions, a
      visit o.alias, a
      visit o.distinct, a
    end

visit_Arel_Nodes_DeleteStatement(o, a)
Alias for: binary
visit_Arel_Nodes_Descending(o, a)
Alias for: unary
visit_Arel_Nodes_DoesNotMatch(o, a)
Alias for: binary
visit_Arel_Nodes_Equality(o, a)
Alias for: binary
visit_Arel_Nodes_Exists(o, a)
Alias for: function
visit_Arel_Nodes_GreaterThan(o, a)
Alias for: binary
visit_Arel_Nodes_GreaterThanOrEqual(o, a)
Alias for: binary
visit_Arel_Nodes_Group(o, a)
Alias for: unary
visit_Arel_Nodes_Grouping(o, a)
Alias for: unary
visit_Arel_Nodes_Having(o, a)
Alias for: unary
visit_Arel_Nodes_In(o, a)
Alias for: binary
visit_Arel_Nodes_InfixOperation(o, a)
Alias for: binary
visit_Arel_Nodes_InnerJoin(o, a)
Alias for: binary
visit_Arel_Nodes_InsertStatement(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 130
    def visit_Arel_Nodes_InsertStatement o, a
      visit o.relation, a
      visit o.columns, a
      visit o.values, a
    end

visit_Arel_Nodes_JoinSource(o, a)
Alias for: binary
visit_Arel_Nodes_LessThan(o, a)
Alias for: binary
visit_Arel_Nodes_LessThanOrEqual(o, a)
Alias for: binary
visit_Arel_Nodes_Limit(o, a)
Alias for: unary
visit_Arel_Nodes_Lock(o, a)
Alias for: terminal
visit_Arel_Nodes_Matches(o, a)
Alias for: binary
visit_Arel_Nodes_Max(o, a)
Alias for: function
visit_Arel_Nodes_Min(o, a)
Alias for: function
visit_Arel_Nodes_NamedFunction(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 42
    def visit_Arel_Nodes_NamedFunction o, a
      visit o.name, a
      visit o.expressions, a
      visit o.distinct, a
      visit o.alias, a
    end

visit_Arel_Nodes_Node(o, a)
Alias for: terminal
visit_Arel_Nodes_Not(o, a)
Alias for: unary
visit_Arel_Nodes_NotEqual(o, a)
Alias for: binary
visit_Arel_Nodes_NotIn(o, a)
Alias for: binary
visit_Arel_Nodes_Offset(o, a)
Alias for: unary
visit_Arel_Nodes_On(o, a)
Alias for: unary
visit_Arel_Nodes_Or(o, a)
Alias for: binary
visit_Arel_Nodes_Ordering(o, a)
Alias for: unary
visit_Arel_Nodes_OuterJoin(o, a)
Alias for: binary
visit_Arel_Nodes_SelectCore(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 136
    def visit_Arel_Nodes_SelectCore o, a
      visit o.projections, a
      visit o.source, a
      visit o.wheres, a
      visit o.groups, a
      visit o.windows, a
      visit o.having, a
    end

visit_Arel_Nodes_SelectStatement(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 145
    def visit_Arel_Nodes_SelectStatement o, a
      visit o.cores, a
      visit o.orders, a
      visit o.limit, a
      visit o.lock, a
      visit o.offset, a
    end

visit_Arel_Nodes_SqlLiteral(o, a)
Alias for: terminal
visit_Arel_Nodes_StringJoin(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 86
    def visit_Arel_Nodes_StringJoin o, a
      visit o.left, a
    end

visit_Arel_Nodes_Sum(o, a)
Alias for: function
visit_Arel_Nodes_TableAlias(o, a)
Alias for: binary
visit_Arel_Nodes_Top(o, a)
Alias for: unary
visit_Arel_Nodes_UnqualifiedColumn(o, a)
Alias for: unary
visit_Arel_Nodes_UpdateStatement(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 153
    def visit_Arel_Nodes_UpdateStatement o, a
      visit o.relation, a
      visit o.values, a
      visit o.wheres, a
      visit o.orders, a
      visit o.limit, a
    end

visit_Arel_Nodes_Values(o, a)
Alias for: binary
visit_Arel_Nodes_Window(o, a)
Alias for: terminal
visit_Arel_SqlLiteral(o, a)
Alias for: terminal
visit_Arel_Table(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 102
    def visit_Arel_Table o, a
      visit o.name, a
    end

visit_Array(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 161
    def visit_Array o, a
      o.each { |i| visit i, a }
    end

visit_BigDecimal(o, a)
Alias for: terminal
visit_Bignum(o, a)
Alias for: terminal
visit_Class(o, a)
Alias for: terminal
visit_Date(o, a)
Alias for: terminal
visit_DateTime(o, a)
Alias for: terminal
visit_FalseClass(o, a)
Alias for: terminal
visit_Fixnum(o, a)
Alias for: terminal
visit_Float(o, a)
Alias for: terminal
visit_Hash(o, a) click to toggle source

    # File lib/arel/visitors/depth_first.rb, line 165
    def visit_Hash o, a
      o.each { |k,v| visit(k, a); visit(v, a) }
    end

visit_NilClass(o, a)
Alias for: terminal
visit_String(o, a)
Alias for: terminal
visit_Symbol(o, a)
Alias for: terminal
visit_Time(o, a)
Alias for: terminal
visit_TrueClass(o, a)
Alias for: terminal