From 7e36dc83f8c4f819d0ab48c65f77e90653c31d2b Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Mon, 6 Oct 2014 17:52:18 -0700 Subject: [PATCH] clean up space representation a bit --- ext/numeric.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/numeric.rb b/ext/numeric.rb index 293e89d5..cf4897fa 100644 --- a/ext/numeric.rb +++ b/ext/numeric.rb @@ -10,6 +10,8 @@ class Numeric end def to_space_pretty - "#{(self.to_f / ONE_MEGABYTE).round(2).to_s} MB" + space = (self.to_f / ONE_MEGABYTE).round(2) + space = space.to_i if space.denominator == 1 + "#{space} MB" end end \ No newline at end of file