module BioVcf::ConvertStringToValue

Public Class Methods

convert(str) click to toggle source
# File lib/bio-vcf/utils.rb, line 12
def self::convert str
  if str =~ /,/
    str.split(/,/).map { |item| convert(item) }
  else
    if integer?(str)
      str.to_i 
    else
      if float?(str)
        str.to_f 
      else
        str
      end
    end
  end
end
float?(str) click to toggle source
# File lib/bio-vcf/utils.rb, line 8
def self::float?(str)
  !!Float(str) rescue false
end
integer?(str) click to toggle source
# File lib/bio-vcf/utils.rb, line 4
def self::integer?(str)
  !!Integer(str) rescue false
end