Sha256: dd45e8865982fac2d259d9a9ca2726c0b0fef35243d898c7702ef49adbed57a3
Contents?: true
Size: 547 Bytes
Versions: 3
Compression:
Stored size: 547 Bytes
Contents
module Svgcode module Utility SCI_SEP = /e/i def self.x_to_f(x) f = if x.is_a?(Numeric) x.to_f elsif x.is_a?(String) if x.match(SCI_SEP) parts = x.split(SCI_SEP) unless parts.length == 2 raise ArgumentError.new('x is an unknown number format') end parts.first.to_f * 10.0 ** parts.last.to_f else x.to_f end else raise ArgumentError.new('x must be a Numeric or a String') end f end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
svgcode-0.6.2 | lib/svgcode/utility.rb |
svgcode-0.6.1 | lib/svgcode/utility.rb |
svgcode-0.6.0 | lib/svgcode/utility.rb |