class ByteNumber
Public Class Methods
from_GB(value)
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 62 def self.from_GB(value) self.new(value*(1024**3)) end
new(int)
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 2 def initialize(int) @int = int end
Public Instance Methods
*(other)
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 50 def *(other) to_i * other end
+(other)
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 42 def +(other) to_i + other end
-(other)
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 46 def -(other) to_i - other end
/(other)
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 54 def /(other) to_i / other end
<=>(other)
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 38 def <=>(other) to_i <=> other end
coerce(other)
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 34 def coerce(other) to_i.coerce(other) end
pow(n)
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 58 def pow(n) self.class.new(to_i ** n) end
to_B()
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 18 def to_B to_i end
to_GB()
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 30 def to_GB _compute_unit_to_n_kilo(3) end
to_KB()
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 22 def to_KB _compute_unit_to_n_kilo(1) end
to_MB()
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 26 def to_MB _compute_unit_to_n_kilo(2) end
to_f()
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 14 def to_f @int.to_f end
to_i()
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 10 def to_i @int end
to_s()
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 6 def to_s @int.to_s end
Private Instance Methods
_compute_unit_to_n_kilo(n=0)
click to toggle source
# File lib/vagrant-libvirt/util/byte_number.rb, line 67 def _compute_unit_to_n_kilo(n=0) (to_f/(1024 ** n)).ceil end