Sha256: 23c2d3cbf5d50a048fa6f4bf0d8c90f0eb3b743636138bd17da90ab77cd7e339
Contents?: true
Size: 540 Bytes
Versions: 18
Compression:
Stored size: 540 Bytes
Contents
module MinMaxComparison # Returns the greater of the object's value or +value+ def max( value ) if value > self value else self end end # Returns the lesser of the object's value or +value+ def min( value ) if value < self value else self end end end class Fixnum include MinMaxComparison end class Rational include MinMaxComparison end class Float include MinMaxComparison def precision(pre) mult = 10 ** pre (self * mult).truncate.to_f / mult end end
Version data entries
18 entries across 18 versions & 1 rubygems