Class: GraphViz::Types::Rect
Constant Summary
collapse
- FLOAT_MASK =
/[-+]?(?:[0-9]*\.[0-9]+|[0-9]+)/
- RECT_FINAL_MASK =
/#{FLOAT_MASK}\s*,\s*#{FLOAT_MASK}\s*,\s*#{FLOAT_MASK}\s*,\s*#{FLOAT_MASK}/
Instance Method Summary
collapse
Methods inherited from Common
#initialize, #source
Instance Method Details
#check(data) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/graphviz/types/rect.rb', line 10
def check(data)
if data.is_a?(String) and RECT_FINAL_MASK.match(data)
@to_ruby = data.split(",").map{ |e| e.to_f }
return data
end
if data.is_a?(Array)
return check(data.join(","))
end
return nil if data.is_a?(String) and data.empty?
raise RectException, "Invalid rect value"
end
|
#output ⇒ Object
Also known as:
to_gv, to_s
23
24
25
|
# File 'lib/graphviz/types/rect.rb', line 23
def output
return @data.to_s.inspect.gsub( "\\\\", "\\" )
end
|
30
31
32
|
# File 'lib/graphviz/types/rect.rb', line 30
def to_ruby
@to_ruby
end
|