class Aruba::FileSize
File Size
Attributes
Public Class Methods
Source
# File lib/aruba/file_size.rb, line 16 def initialize(bytes) @bytes = bytes @divisor = 1024 end
Create file size object
Public Instance Methods
Source
# File lib/aruba/file_size.rb, line 59 def <=>(other) to_i <=> other.to_i end
Compare size with other size
Source
# File lib/aruba/file_size.rb, line 39 def coerce(other) [bytes, other] end
Move to other
Source
# File lib/aruba/file_size.rb, line 22 def to_byte bytes end
Convert to bytes
Also aliased as: to_i
Source
# File lib/aruba/file_size.rb, line 54 def to_gibi_byte to_mebi_byte.to_f / divisor end
Convert to gibi byte
Source
# File lib/aruba/file_size.rb, line 44 def to_kibi_byte to_byte.to_f / divisor end
Convert to kibi byte
Source
# File lib/aruba/file_size.rb, line 49 def to_mebi_byte to_kibi_byte.to_f / divisor end
Convert to mebi byte