Class: Arel::TreeManager
- Inherits:
-
Object
- Object
- Arel::TreeManager
- Includes:
- Relation
- Defined in:
- lib/arel/tree_manager.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#ast ⇒ Object
readonly
Returns the value of attribute ast.
-
#engine ⇒ Object
readonly
Returns the value of attribute engine.
-
#visitor ⇒ Object
Returns the value of attribute visitor.
Instance Method Summary collapse
-
#initialize(engine) ⇒ TreeManager
constructor
A new instance of TreeManager.
- #initialize_copy(other) ⇒ Object
- #to_dot ⇒ Object
- #to_sql ⇒ Object
- #where(expr) ⇒ Object
Constructor Details
#initialize(engine) ⇒ TreeManager
Returns a new instance of TreeManager.
9 10 11 12 13 |
# File 'lib/arel/tree_manager.rb', line 9 def initialize engine @engine = engine @visitor = Visitors.visitor_for @engine @ctx = nil end |
Instance Attribute Details
#ast ⇒ Object (readonly)
Returns the value of attribute ast.
7 8 9 |
# File 'lib/arel/tree_manager.rb', line 7 def ast @ast end |
#engine ⇒ Object (readonly)
Returns the value of attribute engine.
7 8 9 |
# File 'lib/arel/tree_manager.rb', line 7 def engine @engine end |
#visitor ⇒ Object
Returns the value of attribute visitor.
6 7 8 |
# File 'lib/arel/tree_manager.rb', line 6 def visitor @visitor end |
Instance Method Details
#initialize_copy(other) ⇒ Object
23 24 25 26 |
# File 'lib/arel/tree_manager.rb', line 23 def initialize_copy other super @ast = @ast.clone end |
#to_dot ⇒ Object
15 16 17 |
# File 'lib/arel/tree_manager.rb', line 15 def to_dot Visitors::Dot.new.accept @ast end |
#to_sql ⇒ Object
19 20 21 |
# File 'lib/arel/tree_manager.rb', line 19 def to_sql @visitor.accept @ast end |
#where(expr) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/arel/tree_manager.rb', line 28 def where expr if Arel::TreeManager === expr expr = expr.ast end @ctx.wheres << expr self end |