Class: Arel::Visitors::Dot
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Visitor
|
|
Instance Chain:
self,
Visitor
|
|
Inherits: |
Arel::Visitors::Visitor
|
Defined in: | activerecord/lib/arel/visitors/dot.rb |
Class Method Summary
Instance Attribute Summary
Instance Method Summary
- #accept(object, collector)
- #edge(name) private
- #quote(string) private
- #to_dot private
- #visit(o) private
- #visit__children(o) (also: #visit_Arel_Nodes_And, #visit_Arel_Nodes_Or, #visit_Arel_Nodes_With) private
- #visit__no_edges(o) (also: #visit_Arel_Nodes_CurrentRow, #visit_Arel_Nodes_Distinct) private
- #visit__regexp(o) (also: #visit_Arel_Nodes_Regexp, #visit_Arel_Nodes_NotRegexp) private
- #visit_ActiveModel_Attribute(o) private
- #visit_Arel_Attributes_Attribute(o) private
-
#visit_Arel_Nodes_And(o)
private
Alias for #visit__children.
- #visit_Arel_Nodes_Binary(o) private
- #visit_Arel_Nodes_BindParam(o) private
- #visit_Arel_Nodes_Case(o) private
- #visit_Arel_Nodes_Casted(o) private
- #visit_Arel_Nodes_Comment(o) private
- #visit_Arel_Nodes_Count(o) private
-
#visit_Arel_Nodes_CurrentRow(o)
private
Alias for #visit__no_edges.
- #visit_Arel_Nodes_DeleteStatement(o) private
-
#visit_Arel_Nodes_Distinct(o)
private
Alias for #visit__no_edges.
- #visit_Arel_Nodes_Extract(o) private
- #visit_Arel_Nodes_Function(o) private
- #visit_Arel_Nodes_HomogeneousIn(o) private
- #visit_Arel_Nodes_InfixOperation(o) private
- #visit_Arel_Nodes_InsertStatement(o) private
- #visit_Arel_Nodes_NamedFunction(o) private
- #visit_Arel_Nodes_NamedWindow(o) private
-
#visit_Arel_Nodes_NotRegexp(o)
private
Alias for #visit__regexp.
-
#visit_Arel_Nodes_Or(o)
private
Alias for #visit__children.
- #visit_Arel_Nodes_Ordering(o) private
-
#visit_Arel_Nodes_Regexp(o)
private
Alias for #visit__regexp.
- #visit_Arel_Nodes_SelectCore(o) private
- #visit_Arel_Nodes_SelectStatement(o) private
-
#visit_Arel_Nodes_SqlLiteral(o)
private
Alias for #visit_String.
- #visit_Arel_Nodes_StringJoin(o) private
- #visit_Arel_Nodes_TableAlias(o) private
- #visit_Arel_Nodes_Unary(o) private
- #visit_Arel_Nodes_UnaryOperation(o) private
- #visit_Arel_Nodes_UpdateStatement(o) private
- #visit_Arel_Nodes_ValuesList(o) private
- #visit_Arel_Nodes_Window(o) private
-
#visit_Arel_Nodes_With(o)
private
Alias for #visit__children.
- #visit_Arel_Table(o) private
- #visit_Array(o) (also: #visit_Set) private
-
#visit_BigDecimal(o)
private
Alias for #visit_String.
-
#visit_Date(o)
private
Alias for #visit_String.
-
#visit_DateTime(o)
private
Alias for #visit_String.
- #visit_edge(o, method) private
-
#visit_FalseClass(o)
private
Alias for #visit_String.
-
#visit_Float(o)
private
Alias for #visit_String.
- #visit_Hash(o) private
-
#visit_Integer(o)
private
Alias for #visit_String.
-
#visit_NilClass(o)
private
Alias for #visit_String.
-
#visit_Set(o)
private
Alias for #visit_Array.
- #visit_String(o) (also: #visit_Time, #visit_Date, #visit_DateTime, #visit_NilClass, #visit_TrueClass, #visit_FalseClass, #visit_Integer, #visit_BigDecimal, #visit_Float, #visit_Symbol, #visit_Arel_Nodes_SqlLiteral) private
-
#visit_Symbol(o)
private
Alias for #visit_String.
-
#visit_Time(o)
private
Alias for #visit_String.
-
#visit_TrueClass(o)
private
Alias for #visit_String.
- #with_node(node) private
Visitor
- Inherited
Constructor Details
.new ⇒ Dot
# File 'activerecord/lib/arel/visitors/dot.rb', line 19
def initialize super() @nodes = [] @edges = [] @node_stack = [] @edge_stack = [] @seen = {} end
Instance Method Details
#accept(object, collector)
[ GitHub ]#edge(name) (private)
[ GitHub ]#quote(string) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 279
def quote(string) string.to_s.gsub('"', '\"') end
#to_dot (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 283
def to_dot "digraph \"Arel\" {\nnode [width=0.375,height=0.25,shape=record];\n" + @nodes.map { |node| label = "<f0>#{node.name}" node.fields.each_with_index do |field, i| label += "|<f#{i + 1}>#{quote field}" end "#{node.id} [label=\"#{label}\"];" }.join("\n") + "\n" + @edges.map { |edge| "#{edge.from.id} -> #{edge.to.id} [label=\"#{edge.name}\"];" }.join("\n") + "\n}" end
#visit(o) (private)
[ GitHub ]#visit__children(o) (private) Also known as: #visit_Arel_Nodes_And, #visit_Arel_Nodes_Or, #visit_Arel_Nodes_With
[ GitHub ]#visit__no_edges(o) (private) Also known as: #visit_Arel_Nodes_CurrentRow, #visit_Arel_Nodes_Distinct
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 103
def visit__no_edges(o) # intentionally left blank end
#visit__regexp(o) (private) Also known as: #visit_Arel_Nodes_Regexp, #visit_Arel_Nodes_NotRegexp
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 60
def visit__regexp(o) visit_edge o, "left" visit_edge o, "right" visit_edge o, "case_sensitive" end
#visit_ActiveModel_Attribute(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 216
def visit_ActiveModel_Attribute(o) visit_edge(o, "value_before_type_cast") end
#visit_Arel_Attributes_Attribute(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 183
def visit_Arel_Attributes_Attribute(o) visit_edge o, "relation" visit_edge o, "name" end
#visit_Arel_Nodes_And(o) (private)
Alias for #visit__children.
# File 'activerecord/lib/arel/visitors/dot.rb', line 193
alias :visit_Arel_Nodes_And :visit__children
#visit_Arel_Nodes_Binary(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 44
def visit_Arel_Nodes_Binary(o) visit_edge o, "left" visit_edge o, "right" end
#visit_Arel_Nodes_BindParam(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 212
def visit_Arel_Nodes_BindParam(o) visit_edge(o, "value") end
#visit_Arel_Nodes_Case(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 237
def visit_Arel_Nodes_Case(o) visit_edge(o, "case") visit_edge(o, "conditions") visit_edge(o, "default") end
#visit_Arel_Nodes_Casted(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 172
def visit_Arel_Nodes_Casted(o) visit_edge o, "value" visit_edge o, "attribute" end
#visit_Arel_Nodes_Comment(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 233
def visit_Arel_Nodes_Comment(o) visit_edge(o, "values") end
#visit_Arel_Nodes_Count(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 77
def visit_Arel_Nodes_Count(o) visit_edge o, "expressions" visit_edge o, "distinct" end
#visit_Arel_Nodes_CurrentRow(o) (private)
Alias for #visit__no_edges.
# File 'activerecord/lib/arel/visitors/dot.rb', line 106
alias :visit_Arel_Nodes_CurrentRow :visit__no_edges
#visit_Arel_Nodes_DeleteStatement(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 159
def visit_Arel_Nodes_DeleteStatement(o) visit_edge o, "relation" visit_edge o, "wheres" visit_edge o, "orders" visit_edge o, "limit" visit_edge o, "offset" visit_edge o, "key" end
#visit_Arel_Nodes_Distinct(o) (private)
Alias for #visit__no_edges.
# File 'activerecord/lib/arel/visitors/dot.rb', line 107
alias :visit_Arel_Nodes_Distinct :visit__no_edges
#visit_Arel_Nodes_Extract(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 109
def visit_Arel_Nodes_Extract(o) visit_edge o, "expressions" visit_edge o, "alias" end
#visit_Arel_Nodes_Function(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 34
def visit_Arel_Nodes_Function(o) visit_edge o, "expressions" visit_edge o, "distinct" visit_edge o, "alias" end
#visit_Arel_Nodes_HomogeneousIn(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 177
def visit_Arel_Nodes_HomogeneousIn(o) visit_edge o, "values" visit_edge o, "type" visit_edge o, "attribute" end
#visit_Arel_Nodes_InfixOperation(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 54
def visit_Arel_Nodes_InfixOperation(o) visit_edge o, "operator" visit_edge o, "left" visit_edge o, "right" end
#visit_Arel_Nodes_InsertStatement(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 121
def visit_Arel_Nodes_InsertStatement(o) visit_edge o, "relation" visit_edge o, "columns" visit_edge o, "values" visit_edge o, "select" end
#visit_Arel_Nodes_NamedFunction(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 114
def visit_Arel_Nodes_NamedFunction(o) visit_edge o, "name" visit_edge o, "expressions" visit_edge o, "distinct" visit_edge o, "alias" end
#visit_Arel_Nodes_NamedWindow(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 96
def visit_Arel_Nodes_NamedWindow(o) visit_edge o, "partitions" visit_edge o, "orders" visit_edge o, "framing" visit_edge o, "name" end
#visit_Arel_Nodes_NotRegexp(o) (private)
Alias for #visit__regexp.
# File 'activerecord/lib/arel/visitors/dot.rb', line 66
alias :visit_Arel_Nodes_NotRegexp :visit__regexp
#visit_Arel_Nodes_Or(o) (private)
Alias for #visit__children.
# File 'activerecord/lib/arel/visitors/dot.rb', line 194
alias :visit_Arel_Nodes_Or :visit__children
#visit_Arel_Nodes_Ordering(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 68
def visit_Arel_Nodes_Ordering(o) visit_edge o, "expr" end
#visit_Arel_Nodes_Regexp(o) (private)
Alias for #visit__regexp.
# File 'activerecord/lib/arel/visitors/dot.rb', line 65
alias :visit_Arel_Nodes_Regexp :visit__regexp
#visit_Arel_Nodes_SelectCore(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 128
def visit_Arel_Nodes_SelectCore(o) visit_edge o, "source" visit_edge o, "projections" visit_edge o, "wheres" visit_edge o, "windows" visit_edge o, "groups" visit_edge o, "comment" visit_edge o, "havings" visit_edge o, "set_quantifier" visit_edge o, "optimizer_hints" end
#visit_Arel_Nodes_SelectStatement(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 140
def visit_Arel_Nodes_SelectStatement(o) visit_edge o, "cores" visit_edge o, "limit" visit_edge o, "orders" visit_edge o, "offset" visit_edge o, "lock" visit_edge o, "with" end
#visit_Arel_Nodes_SqlLiteral(o) (private)
Alias for #visit_String.
# File 'activerecord/lib/arel/visitors/dot.rb', line 210
alias :visit_Arel_Nodes_SqlLiteral :visit_String
#visit_Arel_Nodes_StringJoin(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 86
def visit_Arel_Nodes_StringJoin(o) visit_edge o, "left" end
#visit_Arel_Nodes_TableAlias(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 72
def visit_Arel_Nodes_TableAlias(o) visit_edge o, "name" visit_edge o, "relation" end
#visit_Arel_Nodes_Unary(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 40
def visit_Arel_Nodes_Unary(o) visit_edge o, "expr" end
#visit_Arel_Nodes_UnaryOperation(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 49
def visit_Arel_Nodes_UnaryOperation(o) visit_edge o, "operator" visit_edge o, "expr" end
#visit_Arel_Nodes_UpdateStatement(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 149
def visit_Arel_Nodes_UpdateStatement(o) visit_edge o, "relation" visit_edge o, "wheres" visit_edge o, "values" visit_edge o, "orders" visit_edge o, "limit" visit_edge o, "offset" visit_edge o, "key" end
#visit_Arel_Nodes_ValuesList(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 82
def visit_Arel_Nodes_ValuesList(o) visit_edge o, "rows" end
#visit_Arel_Nodes_Window(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 90
def visit_Arel_Nodes_Window(o) visit_edge o, "partitions" visit_edge o, "orders" visit_edge o, "framing" end
#visit_Arel_Nodes_With(o) (private)
Alias for #visit__children.
# File 'activerecord/lib/arel/visitors/dot.rb', line 195
alias :visit_Arel_Nodes_With :visit__children
#visit_Arel_Table(o) (private)
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 168
def visit_Arel_Table(o) visit_edge o, "name" end
#visit_Array(o) (private) Also known as: #visit_Set
[ GitHub ]#visit_BigDecimal(o) (private)
Alias for #visit_String.
# File 'activerecord/lib/arel/visitors/dot.rb', line 207
alias :visit_BigDecimal :visit_String
#visit_Date(o) (private)
Alias for #visit_String.
# File 'activerecord/lib/arel/visitors/dot.rb', line 201
alias :visit_Date :visit_String
#visit_DateTime(o) (private)
Alias for #visit_String.
# File 'activerecord/lib/arel/visitors/dot.rb', line 202
alias :visit_DateTime :visit_String
#visit_edge(o, method) (private)
[ GitHub ]#visit_FalseClass(o) (private)
Alias for #visit_String.
# File 'activerecord/lib/arel/visitors/dot.rb', line 205
alias :visit_FalseClass :visit_String
#visit_Float(o) (private)
Alias for #visit_String.
# File 'activerecord/lib/arel/visitors/dot.rb', line 208
alias :visit_Float :visit_String
#visit_Hash(o) (private)
[ GitHub ]#visit_Integer(o) (private)
Alias for #visit_String.
# File 'activerecord/lib/arel/visitors/dot.rb', line 206
alias :visit_Integer :visit_String
#visit_NilClass(o) (private)
Alias for #visit_String.
# File 'activerecord/lib/arel/visitors/dot.rb', line 203
alias :visit_NilClass :visit_String
#visit_Set(o) (private)
Alias for #visit_Array.
# File 'activerecord/lib/arel/visitors/dot.rb', line 231
alias :visit_Set :visit_Array
#visit_String(o) (private) Also known as: #visit_Time, #visit_Date, #visit_DateTime, #visit_NilClass, #visit_TrueClass, #visit_FalseClass, #visit_Integer, #visit_BigDecimal, #visit_Float, #visit_Symbol, #visit_Arel_Nodes_SqlLiteral
[ GitHub ]# File 'activerecord/lib/arel/visitors/dot.rb', line 197
def visit_String(o) @node_stack.last.fields << o end
#visit_Symbol(o) (private)
Alias for #visit_String.
# File 'activerecord/lib/arel/visitors/dot.rb', line 209
alias :visit_Symbol :visit_String
#visit_Time(o) (private)
Alias for #visit_String.
# File 'activerecord/lib/arel/visitors/dot.rb', line 200
alias :visit_Time :visit_String
#visit_TrueClass(o) (private)
Alias for #visit_String.
# File 'activerecord/lib/arel/visitors/dot.rb', line 204
alias :visit_TrueClass :visit_String