Add endl.

Akinori MUSHA 10 anos atrás
pai
commit
23f04ef822
1 arquivos alterados com 9 adições e 3 exclusões
  1. 9 3
      app/helpers/dot_helper.rb

+ 9 - 3
app/helpers/dot_helper.rb

@@ -38,6 +38,12 @@ module DotHelper
38 38
       @dot << string
39 39
     end
40 40
 
41
+    ENDL = ';'.freeze
42
+
43
+    def endl
44
+      @dot << ENDL
45
+    end
46
+
41 47
     def escape(string)
42 48
       # Backslash escaping seems to work for the backslash itself,
43 49
       # though it's not documented in the DOT language docs.
@@ -82,7 +88,7 @@ module DotHelper
82 88
     def node(id, attrs = nil)
83 89
       id id
84 90
       attr_list attrs
85
-      raw ';'
91
+      endl
86 92
     end
87 93
 
88 94
     def edge(from, to, attrs = nil, op = '->')
@@ -90,13 +96,13 @@ module DotHelper
90 96
       raw op
91 97
       id to
92 98
       attr_list attrs
93
-      raw ';'
99
+      endl
94 100
     end
95 101
 
96 102
     def statement(ids, attrs = nil)
97 103
       ids Array(ids)
98 104
       attr_list attrs
99
-      raw ';'
105
+      endl
100 106
     end
101 107
 
102 108
     def block(*ids, &block)