Skip to content
Browse files

adding better dot file support for our nodes

  • Loading branch information...
1 parent 7a625bf commit c308de87fa7a48d980b96c01d43045f17ee487ad @tenderlove tenderlove committed Sep 29, 2010
View
2 lib/arel/nodes/does_not_match.rb
@@ -1,6 +1,6 @@
module Arel
module Nodes
- class DoesNotMatch < Binary
+ class DoesNotMatch < Arel::Nodes::Binary
end
end
end
View
2 lib/arel/nodes/matches.rb
@@ -1,6 +1,6 @@
module Arel
module Nodes
- class Matches < Binary
+ class Matches < Arel::Nodes::Binary
end
end
end
View
2 lib/arel/nodes/not_in.rb
@@ -1,6 +1,6 @@
module Arel
module Nodes
- class NotIn < Binary
+ class NotIn < Arel::Nodes::Binary
end
end
end
View
2 lib/arel/nodes/unqualified_column.rb
@@ -1,6 +1,8 @@
module Arel
module Nodes
class UnqualifiedColumn
+ attr_accessor :attribute
+
def initialize attribute
@attribute = attribute
end
View
38 lib/arel/visitors/dot.rb
@@ -38,6 +38,13 @@ def visit_Arel_Nodes_TableAlias o
visit_edge o, "columns"
end
+ def visit_Arel_Nodes_Sum o
+ visit_edge o, "expressions"
+ visit_edge o, "alias"
+ end
+ alias :visit_Arel_Nodes_Max :visit_Arel_Nodes_Sum
+ alias :visit_Arel_Nodes_Avg :visit_Arel_Nodes_Sum
+
def visit_Arel_Nodes_Count o
visit_edge o, "expressions"
visit_edge o, "distinct"
@@ -54,10 +61,27 @@ def visit_Arel_Nodes_Values o
def visit_Arel_Nodes_StringJoin o
visit_edge o, "left"
visit_edge o, "right"
+ end
+
+ def visit_Arel_Nodes_InnerJoin o
+ visit_edge o, "left"
+ visit_edge o, "right"
visit_edge o, "constraint"
end
- alias :visit_Arel_Nodes_InnerJoin :visit_Arel_Nodes_StringJoin
- alias :visit_Arel_Nodes_OuterJoin :visit_Arel_Nodes_StringJoin
+ alias :visit_Arel_Nodes_OuterJoin :visit_Arel_Nodes_InnerJoin
+
+ def visit_Arel_Nodes_DeleteStatement o
+ visit_edge o, "relation"
+ visit_edge o, "wheres"
+ end
+
+ def visit_Arel_Nodes_UnqualifiedColumn o
+ visit_edge o, "attribute"
+ end
+
+ def visit_Arel_Nodes_Offset o
+ visit_edge o, "value"
+ end
def visit_Arel_Nodes_InsertStatement o
visit_edge o, "relation"
@@ -109,16 +133,26 @@ def visit_Arel_Nodes_Equality o
alias :visit_Arel_Nodes_GreaterThanOrEqual :visit_Arel_Nodes_Equality
alias :visit_Arel_Nodes_Assignment :visit_Arel_Nodes_Equality
alias :visit_Arel_Nodes_In :visit_Arel_Nodes_Equality
+ alias :visit_Arel_Nodes_LessThan :visit_Arel_Nodes_Equality
+ alias :visit_Arel_Nodes_LessThanOrEqual :visit_Arel_Nodes_Equality
+ alias :visit_Arel_Nodes_Between :visit_Arel_Nodes_Equality
+ alias :visit_Arel_Nodes_NotIn :visit_Arel_Nodes_Equality
+ alias :visit_Arel_Nodes_DoesNotMatch :visit_Arel_Nodes_Equality
+ alias :visit_Arel_Nodes_Matches :visit_Arel_Nodes_Equality
def visit_String o
@node_stack.last.fields << o
end
alias :visit_Time :visit_String
+ alias :visit_Date :visit_String
+ alias :visit_DateTime :visit_String
alias :visit_NilClass :visit_String
alias :visit_TrueClass :visit_String
alias :visit_FalseClass :visit_String
alias :visit_Arel_SqlLiteral :visit_String
alias :visit_Fixnum :visit_String
+ alias :visit_BigDecimal :visit_String
+ alias :visit_Float :visit_String
alias :visit_Symbol :visit_String
alias :visit_Arel_Nodes_SqlLiteral :visit_String

0 comments on commit c308de8

Please sign in to comment.
Something went wrong with that request. Please try again.