lib/backports/1.9.1/integer.rb in backports-3.0.3 vs lib/backports/1.9.1/integer.rb in backports-3.1.0
- old
+ new
@@ -1,22 +1,3 @@
-class Integer
- Backports.alias_method self, :magnitude, :abs
+require 'backports/tools'
- if instance_method(:round).arity.zero?
- def round_with_digits(ndigits=0)
- ndigits = Backports::coerce_to_int(ndigits)
- case
- when ndigits.zero?
- self
- when ndigits > 0
- Float(self)
- else
- pow = 10 ** (-ndigits)
- remain = self % pow
- comp = self < 0 ? :<= : :<
- remain -= pow unless remain.send(comp, pow / 2)
- self - remain
- end
- end
- Backports.alias_method_chain self, :round, :digits
- end
-end
\ No newline at end of file
+Backports.require_relative_dir