Sha256: 6430303377b3a60d957a28a90c912b629bd8d8f66e0c9d9561f9e6c9b080831d
Contents?: true
Size: 603 Bytes
Versions: 3
Compression:
Stored size: 603 Bytes
Contents
class DoubleException < RuntimeError end class GraphViz class Types class GvDouble < Common FLOAT_MASK = /[-+]?(?:[0-9]*\.[0-9]+|[0-9]+)/ def check(data) if data.kind_of?(Numeric) or (data.is_a?(String) and FLOAT_MASK.match(data)) return data end raise DoubleException, "Invalid double value" end def output return @data.to_s.inspect.gsub( "\\\\", "\\" ) end def to_f @data.to_f end alias :to_gv :output alias :to_s :output alias :to_ruby :to_f end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby-graphviz-1.0.3 | lib/graphviz/types/gv_double.rb |
ruby-graphviz-1.0.2 | lib/graphviz/types/gv_double.rb |
ruby-graphviz-1.0.1 | lib/graphviz/types/gv_double.rb |