diff options
Diffstat (limited to 'lib/arel/visitors/dot.rb')
-rw-r--r-- | lib/arel/visitors/dot.rb | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/arel/visitors/dot.rb b/lib/arel/visitors/dot.rb index 9bf9f88d18..12cce1e266 100644 --- a/lib/arel/visitors/dot.rb +++ b/lib/arel/visitors/dot.rb @@ -22,12 +22,13 @@ module Arel @seen = {} end - def accept object - super - to_dot + def accept object, collector + visit object + collector << to_dot end private + def visit_Arel_Nodes_Ordering o visit_edge o, "expr" end @@ -54,7 +55,9 @@ module Arel visit_edge o, "left" visit_edge o, "right" end - alias :visit_Arel_Nodes_OuterJoin :visit_Arel_Nodes_InnerJoin + alias :visit_Arel_Nodes_FullOuterJoin :visit_Arel_Nodes_InnerJoin + alias :visit_Arel_Nodes_OuterJoin :visit_Arel_Nodes_InnerJoin + alias :visit_Arel_Nodes_RightOuterJoin :visit_Arel_Nodes_InnerJoin def visit_Arel_Nodes_DeleteStatement o visit_edge o, "relation" @@ -65,7 +68,6 @@ module Arel visit_edge o, "expr" end alias :visit_Arel_Nodes_Group :unary - alias :visit_Arel_Nodes_BindParam :unary alias :visit_Arel_Nodes_Grouping :unary alias :visit_Arel_Nodes_Having :unary alias :visit_Arel_Nodes_Limit :unary @@ -80,15 +82,17 @@ module Arel alias :visit_Arel_Nodes_Range :unary def window o + visit_edge o, "partitions" visit_edge o, "orders" visit_edge o, "framing" end alias :visit_Arel_Nodes_Window :window def named_window o + visit_edge o, "partitions" visit_edge o, "orders" visit_edge o, "framing" - visit_edge o, "name" + visit_edge o, "name" end alias :visit_Arel_Nodes_NamedWindow :named_window @@ -126,7 +130,7 @@ module Arel visit_edge o, "source" visit_edge o, "projections" visit_edge o, "wheres" - visit_edge o, "windows" + visit_edge o, "windows" end def visit_Arel_Nodes_SelectStatement o @@ -194,7 +198,7 @@ module Arel alias :visit_NilClass :visit_String alias :visit_TrueClass :visit_String alias :visit_FalseClass :visit_String - alias :visit_Arel_SqlLiteral :visit_String + alias :visit_Arel_Nodes_BindParam :visit_String alias :visit_Fixnum :visit_String alias :visit_BigDecimal :visit_String alias :visit_Float :visit_String @@ -255,7 +259,7 @@ module Arel end def to_dot - "digraph \"ARel\" {\nnode [width=0.375,height=0.25,shape=record];\n" + + "digraph \"Arel\" {\nnode [width=0.375,height=0.25,shape=record];\n" + @nodes.map { |node| label = "<f0>#{node.name}" |