diff options
Diffstat (limited to 'lib/arel/visitors/dot.rb')
-rw-r--r-- | lib/arel/visitors/dot.rb | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/lib/arel/visitors/dot.rb b/lib/arel/visitors/dot.rb index cb4c2d494c..d5033d166d 100644 --- a/lib/arel/visitors/dot.rb +++ b/lib/arel/visitors/dot.rb @@ -28,41 +28,41 @@ module Arel end private - def visit_Arel_Nodes_Ordering o, a - visit_edge o, a, "expr" + def visit_Arel_Nodes_Ordering o + visit_edge o, "expr" end - def visit_Arel_Nodes_TableAlias o, a - visit_edge o, a, "name" - visit_edge o, a, "relation" + def visit_Arel_Nodes_TableAlias o + visit_edge o, "name" + visit_edge o, "relation" end - def visit_Arel_Nodes_Count o, a - visit_edge o, a, "expressions" - visit_edge o, a, "distinct" + def visit_Arel_Nodes_Count o + visit_edge o, "expressions" + visit_edge o, "distinct" end - def visit_Arel_Nodes_Values o, a - visit_edge o, a, "expressions" + def visit_Arel_Nodes_Values o + visit_edge o, "expressions" end - def visit_Arel_Nodes_StringJoin o, a - visit_edge o, a, "left" + def visit_Arel_Nodes_StringJoin o + visit_edge o, "left" end - def visit_Arel_Nodes_InnerJoin o, a - visit_edge o, a, "left" - visit_edge o, a, "right" + def visit_Arel_Nodes_InnerJoin o + visit_edge o, "left" + visit_edge o, "right" end alias :visit_Arel_Nodes_OuterJoin :visit_Arel_Nodes_InnerJoin - def visit_Arel_Nodes_DeleteStatement o, a - visit_edge o, a, "relation" - visit_edge o, a, "wheres" + def visit_Arel_Nodes_DeleteStatement o + visit_edge o, "relation" + visit_edge o, "wheres" end - def unary o, a - visit_edge o, a, "expr" + def unary o + visit_edge o, "expr" end alias :visit_Arel_Nodes_Group :unary alias :visit_Arel_Nodes_Grouping :unary @@ -78,23 +78,23 @@ module Arel alias :visit_Arel_Nodes_Rows :unary alias :visit_Arel_Nodes_Range :unary - def window o, a - visit_edge o, a, "orders" - visit_edge o, a, "framing" + def window o + visit_edge o, "orders" + visit_edge o, "framing" end alias :visit_Arel_Nodes_Window :window - def named_window o, a - visit_edge o, a, "orders" - visit_edge o, a, "framing" - visit_edge o, a, "name" + def named_window o + visit_edge o, "orders" + visit_edge o, "framing" + visit_edge o, "name" end alias :visit_Arel_Nodes_NamedWindow :named_window - def function o, a - visit_edge o, a, "expressions" - visit_edge o, a, "distinct" - visit_edge o, a, "alias" + def function o + visit_edge o, "expressions" + visit_edge o, "distinct" + visit_edge o, "alias" end alias :visit_Arel_Nodes_Exists :function alias :visit_Arel_Nodes_Min :function @@ -102,52 +102,52 @@ module Arel alias :visit_Arel_Nodes_Avg :function alias :visit_Arel_Nodes_Sum :function - def extract o, a - visit_edge o, a, "expressions" - visit_edge o, a, "alias" + def extract o + visit_edge o, "expressions" + visit_edge o, "alias" end alias :visit_Arel_Nodes_Extract :extract - def visit_Arel_Nodes_NamedFunction o, a - visit_edge o, a, "name" - visit_edge o, a, "expressions" - visit_edge o, a, "distinct" - visit_edge o, a, "alias" + def visit_Arel_Nodes_NamedFunction o + visit_edge o, "name" + visit_edge o, "expressions" + visit_edge o, "distinct" + visit_edge o, "alias" end - def visit_Arel_Nodes_InsertStatement o, a - visit_edge o, a, "relation" - visit_edge o, a, "columns" - visit_edge o, a, "values" + def visit_Arel_Nodes_InsertStatement o + visit_edge o, "relation" + visit_edge o, "columns" + visit_edge o, "values" end - def visit_Arel_Nodes_SelectCore o, a - visit_edge o, a, "source" - visit_edge o, a, "projections" - visit_edge o, a, "wheres" - visit_edge o, a, "windows" + def visit_Arel_Nodes_SelectCore o + visit_edge o, "source" + visit_edge o, "projections" + visit_edge o, "wheres" + visit_edge o, "windows" end - def visit_Arel_Nodes_SelectStatement o, a - visit_edge o, a, "cores" - visit_edge o, a, "limit" - visit_edge o, a, "orders" - visit_edge o, a, "offset" + def visit_Arel_Nodes_SelectStatement o + visit_edge o, "cores" + visit_edge o, "limit" + visit_edge o, "orders" + visit_edge o, "offset" end - def visit_Arel_Nodes_UpdateStatement o, a - visit_edge o, a, "relation" - visit_edge o, a, "wheres" - visit_edge o, a, "values" + def visit_Arel_Nodes_UpdateStatement o + visit_edge o, "relation" + visit_edge o, "wheres" + visit_edge o, "values" end - def visit_Arel_Table o, a - visit_edge o, a, "name" + def visit_Arel_Table o + visit_edge o, "name" end - def visit_Arel_Attribute o, a - visit_edge o, a, "relation" - visit_edge o, a, "name" + def visit_Arel_Attribute o + visit_edge o, "relation" + visit_edge o, "name" end alias :visit_Arel_Attributes_Integer :visit_Arel_Attribute alias :visit_Arel_Attributes_Float :visit_Arel_Attribute @@ -156,16 +156,16 @@ module Arel alias :visit_Arel_Attributes_Boolean :visit_Arel_Attribute alias :visit_Arel_Attributes_Attribute :visit_Arel_Attribute - def nary o, a + def nary o o.children.each_with_index do |x,i| - edge(i) { visit x, a } + edge(i) { visit x } end end alias :visit_Arel_Nodes_And :nary - def binary o, a - visit_edge o, a, "left" - visit_edge o, a, "right" + def binary o + visit_edge o, "left" + visit_edge o, "right" end alias :visit_Arel_Nodes_As :binary alias :visit_Arel_Nodes_Assignment :binary @@ -184,7 +184,7 @@ module Arel alias :visit_Arel_Nodes_Or :binary alias :visit_Arel_Nodes_Over :binary - def visit_String o, a + def visit_String o @node_stack.last.fields << o end alias :visit_Time :visit_String @@ -200,23 +200,23 @@ module Arel alias :visit_Symbol :visit_String alias :visit_Arel_Nodes_SqlLiteral :visit_String - def visit_Hash o, a + def visit_Hash o o.each_with_index do |pair, i| edge("pair_#{i}") { visit pair, a } end end - def visit_Array o, a + def visit_Array o o.each_with_index do |x,i| - edge(i) { visit x, a } + edge(i) { visit x } end end - def visit_edge o, a, method - edge(method) { visit o.send(method), a } + def visit_edge o, method + edge(method) { visit o.send(method) } end - def visit o, a = nil + def visit o = nil if node = @seen[o.object_id] @edge_stack.last.to = node return |