# File lib/couchrest/model/typecast.rb, line 52 def typecast_to_numeric(value, method) if value.is_a?(String) value = value.strip.gsub(/,/, '.').gsub(/[^\d\-\.]/, '').gsub(/\.(?!\d*\Z)/, '') value.empty? ? nil : value.send(method) elsif value.respond_to?(method) value.send(method) else nil end end