Sha256: 5ac65f9866b5527e51acd86041669674211ace8a805aec5008bf11afd203d5c8
Contents?: true
Size: 409 Bytes
Versions: 3
Compression:
Stored size: 409 Bytes
Contents
class Numeric if (instance_method :truncate).arity == 0 def truncate_to_precision precision if (precision = precision.to_i) > 0 factor = 10 ** precision (self * factor).truncate.fdiv factor else truncate end end else # use native method in Ruby >= 2.4 alias :truncate_to_precision :truncate end unless method_defined? :truncate_to_precision end
Version data entries
3 entries across 3 versions & 1 rubygems