a guest Jul 12th, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- Float.class_eval do
- alias_method :original_round, :round
- def round(decs = 0)
- if decs == 0
- elsif decs > 0
- decs = decs.to_i
- (self * 10 ** decs).original_round.to_f / 10 ** decs
- raise ArgumentError, "You can't pass negative arguments"
RAW Paste Data