File Size
Create file size object
# File lib/aruba/file_size.rb, line 16 def initialize(bytes) @bytes = bytes @divisor = 1024 end
Compare size with other size
# File lib/aruba/file_size.rb, line 59 def <=>(other) to_i <=> other.to_i end
Move to other
# File lib/aruba/file_size.rb, line 39 def coerce(other) [bytes, other] end
Convert to bytes
# File lib/aruba/file_size.rb, line 22 def to_byte bytes end
Convert to float
# File lib/aruba/file_size.rb, line 28 def to_f to_i.to_f end
Convert to gibi byte
# File lib/aruba/file_size.rb, line 54 def to_gibi_byte to_mebi_byte.to_f / divisor end
Convert to kibi byte
# File lib/aruba/file_size.rb, line 44 def to_kibi_byte to_byte.to_f / divisor end
Convert to mebi byte
# File lib/aruba/file_size.rb, line 49 def to_mebi_byte to_kibi_byte.to_f / divisor end
Convert to string
# File lib/aruba/file_size.rb, line 33 def to_s to_i.to_s end