Merge branch 'master' of github.com:couchrest/couchrest_model

Conflicts:
	history.txt
This commit is contained in:
Sam Lown 2011-03-13 19:53:52 +01:00
commit 0e51dcfb9a
4 changed files with 18 additions and 2 deletions

View file

@ -79,7 +79,7 @@ module CouchRest
# Match numeric string
def typecast_to_numeric(value, method)
if value.respond_to?(:to_str)
if value.gsub(/,/, '.').gsub(/\.(?!\d*\Z)/, '').to_str =~ /\A(-?(?:0|[1-9]\d*)(?:\.\d+)?|(?:\.\d+))\z/
if value.strip.gsub(/,/, '.').gsub(/\.(?!\d*\Z)/, '').to_str =~ /\A(-?(?:0|[1-9]\d*)(?:\.\d+)?|(?:\.\d+))\z/
$1.send(method)
else
value