Class: Numeric
- Inherits:
-
Object
- Object
- Numeric
- Defined in:
- lib/sys/windows/sys/filesystem.rb,
lib/sys/unix/sys/filesystem.rb
Overview
Some convenient methods for converting bytes to kb, mb, and gb.
Instance Method Summary collapse
-
#to_gb ⇒ Object
call-seq:
num
.to_gb. -
#to_kb ⇒ Object
call-seq:
num
.to_kb. -
#to_mb ⇒ Object
call-seq:
num
.to_mb. -
#to_tb ⇒ Object
call-seq:
num
.to_gb.
Instance Method Details
#to_gb ⇒ Object
call-seq:
<tt>num</tt>.to_gb
Returns num
in terms of gigabytes.
395 396 397 |
# File 'lib/sys/unix/sys/filesystem.rb', line 395 def to_gb self / 1073741824 end |
#to_kb ⇒ Object
call-seq:
<tt>num</tt>.to_kb
Returns num
in terms of kilobytes.
385 386 387 |
# File 'lib/sys/unix/sys/filesystem.rb', line 385 def to_kb self / 1024 end |
#to_mb ⇒ Object
call-seq:
<tt>num</tt>.to_mb
Returns num
in terms of megabytes.
390 391 392 |
# File 'lib/sys/unix/sys/filesystem.rb', line 390 def to_mb self / 1048576 end |
#to_tb ⇒ Object
call-seq:
<tt>num</tt>.to_gb
Returns num
in terms of terabytes.
400 401 402 |
# File 'lib/sys/unix/sys/filesystem.rb', line 400 def to_tb self / 1099511627776 end |