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 16
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 59
def <=>(other)
  to_i <=> other.to_i
end
coerce(other) click to toggle source

Move to other

# File lib/aruba/file_size.rb, line 39
def coerce(other)
  [bytes, other]
end
inspect()
Alias for: to_s
to_byte() click to toggle source

Convert to bytes

# File lib/aruba/file_size.rb, line 22
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 28
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 54
def to_gibi_byte
  to_mebi_byte.to_f / divisor
end
to_i()
Alias for: to_byte
to_kibi_byte() click to toggle source

Convert to kibi byte

# File lib/aruba/file_size.rb, line 44
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 49
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 33
def to_s
  to_i.to_s
end
Also aliased as: inspect