Class: GraphViz::Types::LblString
- Inherits:
-
Common
show all
- Defined in:
- lib/graphviz/types/lbl_string.rb
Instance Method Summary
collapse
Instance Method Details
#check(data) ⇒ Object
6
7
8
|
# File 'lib/graphviz/types/lbl_string.rb', line 6
def check(data)
return data
end
|
#output ⇒ Object
Also known as:
to_gv, to_s, to_ruby
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/graphviz/types/lbl_string.rb', line 10
def output
html = /^<(.*)>$/m.match(@data.to_s)
if html != nil
xml = "<gv>" + html[1].to_s + "</gv>"
begin
doc = REXML::Document.new(xml)
unless doc.root.text == html[1].to_s
"<#{html[1]}>"
else
@data.to_s.inspect.gsub( "\\\\", "\\" )
end
rescue REXML::ParseException => _
@data.to_s.inspect.gsub( "\\\\", "\\" )
end
else
@data.to_s.inspect.gsub( "\\\\", "\\" )
end
end
|