Class: Float

Inherits:
Object
  • Object
show all
Defined in:
lib/importex/ruby_additions.rb

Class Method Summary (collapse)

Class Method Details

+ (Object) importex_value(str)



14
15
16
17
18
19
20
21
22
# File 'lib/importex/ruby_additions.rb', line 14

def self.importex_value(str)
  unless str.blank?
    if str =~ /^[.\d]+$/
      str.to_f
    else
      raise Importex::InvalidCell, "Not a number."
    end
  end
end