Sha256: a268cff36b39f5d289add768b9ae55727250b3ac3944a40fd73291252a283c44
Contents?: true
Size: 804 Bytes
Versions: 2
Compression:
Stored size: 804 Bytes
Contents
module DataMapper class Property module Typecast module Numeric # Match numeric string # # @param [#to_str, Numeric] value # value to typecast # @param [Symbol] method # method to typecast with # # @return [Numeric] # number if matched, value if no match # # @api private def typecast_to_numeric(value, method) if value.respond_to?(:to_str) if value.to_str =~ /\A(-?(?:0|[1-9]\d*)(?:\.\d+)?|(?:\.\d+))\z/ ::Regexp.last_match(1).send(method) else value end elsif value.respond_to?(method) value.send(method) else value end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sbf-dm-core-1.3.0 | lib/dm-core/property/typecast/numeric.rb |
sbf-dm-core-1.3.0.beta | lib/dm-core/property/typecast/numeric.rb |