lib/hashstruct.rb in hashstruct-1.5 vs lib/hashstruct.rb in hashstruct-1.6
- old
+ new
@@ -39,19 +39,19 @@
case obj.strip
# URI
when %r{^(ftp|http|https|mailto):}
URI.parse(obj) rescue obj
# integer
- when %r{^-?[1-9][\d,]*$}
- obj.gsub(/,/, '').to_i
+ when %r{^-?[1-9]\d*$}
+ obj.to_i
# hex integer
when %r{^0x[0-9a-f]+$}i
obj.hex
# float
- when %r{^-?[\d,]+\.\d+$}
- obj.gsub(/,/, '').to_f
+ when %r{^-?\d+\.\d+$}
+ obj.to_f
# percent
- when %r{^-?[\d,]+(\.\d+)?%$}
+ when %r{^-?\d+(\.\d+)?%$}
obj.to_f / 100
# rational
when %r{^(\d+)/(\d+)$}
Rational($1.to_i, $2.to_i)
# date
\ No newline at end of file