Class: Arel::TreeManager
- Inherits:
-
Object
- Object
- Arel::TreeManager
- Includes:
- FactoryMethods
- Defined in:
- lib/arel/tree_manager.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#ast ⇒ Object
readonly
Returns the value of attribute ast.
-
#bind_values ⇒ Object
Returns the value of attribute bind_values.
-
#engine ⇒ Object
readonly
Returns the value of attribute engine.
Instance Method Summary collapse
-
#initialize(engine) ⇒ TreeManager
constructor
A new instance of TreeManager.
- #initialize_copy(other) ⇒ Object
- #to_dot ⇒ Object
- #to_sql ⇒ Object
- #visitor ⇒ Object
- #where(expr) ⇒ Object
Methods included from FactoryMethods
#create_and, #create_false, #create_join, #create_on, #create_string_join, #create_table_alias, #create_true, #grouping, #lower
Constructor Details
#initialize(engine) ⇒ TreeManager
Returns a new instance of TreeManager.
11 12 13 14 15 |
# File 'lib/arel/tree_manager.rb', line 11 def initialize engine @engine = engine @ctx = nil @bind_values = [] 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 |
#bind_values ⇒ Object
Returns the value of attribute bind_values.
9 10 11 |
# File 'lib/arel/tree_manager.rb', line 9 def bind_values @bind_values 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 |
Instance Method Details
#initialize_copy(other) ⇒ Object
33 34 35 36 |
# File 'lib/arel/tree_manager.rb', line 33 def initialize_copy other super @ast = @ast.clone end |
#to_dot ⇒ Object
17 18 19 20 21 |
# File 'lib/arel/tree_manager.rb', line 17 def to_dot collector = Arel::Collectors::PlainString.new collector = Visitors::Dot.new.accept @ast, collector collector.value end |
#to_sql ⇒ Object
27 28 29 30 31 |
# File 'lib/arel/tree_manager.rb', line 27 def to_sql collector = Arel::Collectors::SQLString.new collector = visitor.accept @ast, collector collector.value end |
#visitor ⇒ Object
23 24 25 |
# File 'lib/arel/tree_manager.rb', line 23 def visitor engine.connection.visitor end |
#where(expr) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/arel/tree_manager.rb', line 38 def where expr if Arel::TreeManager === expr expr = expr.ast end @ctx.wheres << expr self end |