# File lib/arel/algebra/attributes/attribute.rb, line 274 def type_cast_to_numeric(value, method) return unless value if value.respond_to?(:to_str) str = value.to_str.strip return if str.empty? return $1.send(method) if str =~ /\A(-?(?:0|[1-9]\d*)(?:\.\d+)?|(?:\.\d+))\z/ elsif value.respond_to?(method) return value.send(method) end raise typecast_error(value) end