mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
doing a little cleanup on the visitors
This commit is contained in:
parent
1d30f5cdae
commit
691c9d2d96
4 changed files with 9 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
module Arel
|
||||
module Visitors
|
||||
class Dot
|
||||
class Dot < Arel::Visitors::Visitor
|
||||
class Node # :nodoc:
|
||||
attr_accessor :name, :id, :fields
|
||||
|
||||
|
@ -23,7 +23,7 @@ module Arel
|
|||
end
|
||||
|
||||
def accept object
|
||||
visit object
|
||||
super
|
||||
to_dot
|
||||
end
|
||||
|
||||
|
@ -188,7 +188,7 @@ module Arel
|
|||
@seen[node.id] = node
|
||||
@nodes << node
|
||||
with_node node do
|
||||
send "visit_#{o.class.name.gsub('::', '_')}", o
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ module Arel
|
|||
# This visitor is used in SelectManager#join_sql and is for backwards
|
||||
# compatibility with Arel V1.0
|
||||
class JoinSql < Arel::Visitors::ToSql
|
||||
private
|
||||
|
||||
def visit_Arel_Nodes_SelectCore o
|
||||
[o.froms].grep(Nodes::Join).map { |x| visit x }.join ', '
|
||||
end
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
module Arel
|
||||
module Visitors
|
||||
class MySQL < Arel::Visitors::ToSql
|
||||
private
|
||||
|
||||
def visit_Arel_Nodes_UpdateStatement o
|
||||
[
|
||||
"UPDATE #{visit o.relation}",
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
module Arel
|
||||
module Visitors
|
||||
class OrderClauses < Arel::Visitors::ToSql
|
||||
private
|
||||
|
||||
def visit_Arel_Nodes_SelectStatement o
|
||||
o.orders.map { |x| visit x }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue