Class: Fixnum
- Inherits:
-
Object
- Object
- Fixnum
- Defined in:
- lib/backups/ext/fixnum.rb,
lib/backups/ext/fixnum.rb
Instance Method Summary collapse
Instance Method Details
#european ⇒ Object
3 4 5 |
# File 'lib/backups/ext/fixnum.rb', line 3 def european self.to_s.reverse.gsub(/...(?=.)/,'\& ').reverse end |
#to_filesize ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/backups/ext/fixnum.rb', line 11 def to_filesize { 'B' => 1024, 'KB' => 1024 * 1024, 'MB' => 1024 * 1024 * 1024, 'GB' => 1024 * 1024 * 1024 * 1024, 'TB' => 1024 * 1024 * 1024 * 1024 * 1024 }.each_pair {|e, s| return "#{(self.to_f / (s/1024)).round(2)} #{e}" if self < s } end |