class Aruba::FileSize
File Size
Attributes
bytes[R]
divisor[R]
Public Class Methods
new(bytes)
click to toggle source
Create file size object
# File lib/aruba/file_size.rb, line 18 def initialize(bytes) @bytes = bytes @divisor = 1024 end
Public Instance Methods
<=>(other)
click to toggle source
Compare size with other size
# File lib/aruba/file_size.rb, line 61 def <=>(other) to_i <=> other.to_i end
coerce(other)
click to toggle source
Move to other
# File lib/aruba/file_size.rb, line 41 def coerce(other) [bytes, other] end
to_byte()
click to toggle source
Convert to bytes
# File lib/aruba/file_size.rb, line 24 def to_byte bytes end
Also aliased as: to_i
to_f()
click to toggle source
Convert to float
# File lib/aruba/file_size.rb, line 30 def to_f to_i.to_f end
to_gibi_byte()
click to toggle source
Convert to gibi byte
# File lib/aruba/file_size.rb, line 56 def to_gibi_byte to_mebi_byte.to_f / divisor end
to_kibi_byte()
click to toggle source
Convert to kibi byte
# File lib/aruba/file_size.rb, line 46 def to_kibi_byte to_byte.to_f / divisor end
to_mebi_byte()
click to toggle source
Convert to mebi byte
# File lib/aruba/file_size.rb, line 51 def to_mebi_byte to_kibi_byte.to_f / divisor end
to_s()
click to toggle source
Convert to string
# File lib/aruba/file_size.rb, line 35 def to_s to_i.to_s end
Also aliased as: inspect