Sha256: a72fa66adffe2ab7bba0dc6abdac3828c536cee3bd2c62363c58beabeab3a0fb

Contents?: true

Size: 379 Bytes

Versions: 1

Compression:

Stored size: 379 Bytes

Contents

module BioVcf

  module ConvertStringToValue
    def self::integer?(str)
      !!Integer(str) rescue false
    end

    def self::float?(str)
      !!Float(str) rescue false
    end

    def self::convert v
      if integer?(v)  # the common case
        v = v.to_i
      else
        # 150.268 or 9.68463e-05
        v = v.to_f if float?(v)
      end
      v
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bio-vcf-0.0.3 lib/bio-vcf/utils.rb