Class: Arel::Nodes::Node

### Home Classes Methods

### In Files

- lib/arel/nodes/node.rb

### Parent

Object

### Methods

- #and
- #each
- #not
- #or
- #to_sql

### Included Modules

- Arel::FactoryMethods
- Enumerable

### Files

- History.txt
- MIT-LICENSE.txt
- Manifest.txt

### Class/Module Index

Quicksearch

- Arel
- Arel::AliasPredication
- Arel::Attributes
- Arel::Attributes::Attribute
- Arel::Attributes::Boolean
- Arel::Attributes::Decimal
- Arel::Attributes::Float
- Arel::Attributes::Integer
- Arel::Attributes::String
- Arel::Attributes::Time
- Arel::Attributes::Undefined
- Arel::Crud
- Arel::DeleteManager
- Arel::Expression
- Arel::Expressions
- Arel::FactoryMethods
- Arel::InsertManager
- Arel::Math
- Arel::Nodes
- Arel::Nodes::Addition
- Arel::Nodes::And
- Arel::Nodes::Ascending
- Arel::Nodes::Binary
- Arel::Nodes::BindParam
- Arel::Nodes::Count
- Arel::Nodes::CurrentRow
- Arel::Nodes::DeleteStatement
- Arel::Nodes::Descending
- Arel::Nodes::Distinct
- Arel::Nodes::Division
- Arel::Nodes::Equality
- Arel::Nodes::Extract
- Arel::Nodes::False
- Arel::Nodes::Following
- Arel::Nodes::Function
- Arel::Nodes::In
- Arel::Nodes::InfixOperation
- Arel::Nodes::InnerJoin
- Arel::Nodes::InsertStatement
- Arel::Nodes::JoinSource
- Arel::Nodes::Multiplication
- Arel::Nodes::NamedFunction
- Arel::Nodes::NamedWindow
- Arel::Nodes::Node
- Arel::Nodes::Ordering
- Arel::Nodes::OuterJoin
- Arel::Nodes::Over
- Arel::Nodes::Preceding
- Arel::Nodes::Range
- Arel::Nodes::Rows
- Arel::Nodes::SelectCore
- Arel::Nodes::SelectStatement
- Arel::Nodes::SqlLiteral
- Arel::Nodes::StringJoin
- Arel::Nodes::Subtraction
- Arel::Nodes::TableAlias
- Arel::Nodes::True
- Arel::Nodes::Unary
- Arel::Nodes::UnqualifiedColumn
- Arel::Nodes::UpdateStatement
- Arel::Nodes::Values
- Arel::Nodes::Window
- Arel::Nodes::With
- Arel::Nodes::WithRecursive
- Arel::OrderPredications
- Arel::Predications
- Arel::Relation
- Arel::SelectManager
- Arel::Sql
- Arel::Sql::Engine
- Arel::SqlLiteral
- Arel::Table
- Arel::TreeManager
- Arel::UpdateManager
- Arel::Visitors
- Arel::Visitors::BindVisitor
- Arel::Visitors::DepthFirst
- Arel::Visitors::Dot
- Arel::Visitors::IBM_DB
- Arel::Visitors::Informix
- Arel::Visitors::JoinSql
- Arel::Visitors::MSSQL
- Arel::Visitors::MySQL
- Arel::Visitors::Oracle
- Arel::Visitors::OrderClauses
- Arel::Visitors::PostgreSQL
- Arel::Visitors::SQLite
- Arel::Visitors::ToSql
- Arel::Visitors::Visitor
- Arel::Visitors::WhereSql
- Arel::WindowPredications

No matching classes.

# Arel::Nodes::Node

Abstract base class for all AST nodes

### Public Instance Methods

and(right) click to toggle source

Factory method to create an Nodes::And node.

    # File lib/arel/nodes/node.rb, line 25
    def and right
      Nodes::And.new [self, right]
    end

each(&block) click to toggle source

Iterate through AST, nodes will be yielded depth-first

    # File lib/arel/nodes/node.rb, line 39
    def each &block
      return enum_for(:each) unless block_given?

      ::Arel::Visitors::DepthFirst.new(block).accept self
    end

not() click to toggle source

Factory method to create a Nodes::Not node that has the recipient of the caller as a child.

    # File lib/arel/nodes/node.rb, line 12
    def not
      Nodes::Not.new self
    end

or(right) click to toggle source

Factory method to create a Nodes::Grouping node that has an Nodes::Or node as a child.

    # File lib/arel/nodes/node.rb, line 19
    def or right
      Nodes::Grouping.new Nodes::Or.new(self, right)
    end

to_sql(engine = Table.engine) click to toggle source

FIXME: this method should go away. I don't like people calling to_sql on non-head nodes. This forces us to walk the AST until we can find a node that has a "relation" member.

Maybe we should just use `Table.engine`? :'(

    # File lib/arel/nodes/node.rb, line 34
    def to_sql engine = Table.engine
      engine.connection.visitor.accept self
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.