lib/fugit/duration.rb in fugit-0.9.4 vs lib/fugit/duration.rb in fugit-0.9.5
- old
+ new
@@ -38,12 +38,14 @@
return s if s.is_a?(self)
original = s
- s = s
- #s = s.to_i if s.is_a?(Numeric)
- s = s.to_s.strip
+ s = s.to_s if s.is_a?(Numeric)
+
+ return nil unless s.is_a?(String)
+
+ s = s.strip
s = s + 's' if s.match(/\A-?(\d*\.)?\d+\z/)
#p [ original, s ]; Raabro.pp(Parser.parse(s, debug: 3))
h =
if opts[:iso]