Class: GraphViz::Types::GvDouble
Constant Summary
collapse
- FLOAT_MASK =
/[-+]?(?:[0-9]*\.[0-9]+|[0-9]+)/
Instance Method Summary
collapse
Instance Method Details
#check(data) ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/graphviz/types/gv_double.rb', line 9
def check(data)
if data.kind_of?(Numeric) or (data.is_a?(String) and FLOAT_MASK.match(data))
return data
end
return nil if data.is_a?(String) and data.empty?
raise DoubleException, "Invalid double value for `#{data}`"
end
|
#output ⇒ Object
Also known as:
to_gv, to_s
19
20
21
|
# File 'lib/graphviz/types/gv_double.rb', line 19
def output
return @data.to_s.inspect.gsub( "\\\\", "\\" )
end
|
#to_f ⇒ Object
Also known as:
to_ruby
23
24
25
|
# File 'lib/graphviz/types/gv_double.rb', line 23
def to_f
@data.to_f
end
|