class Numeric
Requiring bytesize/units
adds convenience methods to Numeric for easy creation of ByteSize and IECByteSize values.
Examples of use¶ ↑
require 'bytesize/units' 1.21.gib #=> (1.21 GiB) 3.tb #=> (3 TB) 100.gb #=> (100 GB) 42.gib.to_mib #=> 43008.0 22.gib.to_si #=> (23.62 GB) 16.gb.to_iec #=> (14.9 GiB)
Public Instance Methods
Returns a new instance of ByteSize representing self number of bytes.
# File lib/bytesize/units.rb, line 67
Returns a new instance of ByteSize representing self number of exabytes.
# File lib/bytesize/units.rb, line 127
Returns a new instance of IECByteSize representing self number of exbibytes.
# File lib/bytesize/units.rb, line 207
Returns a new instance of ByteSize representing self number of gigabytes.
# File lib/bytesize/units.rb, line 97
Returns a new instance of IECByteSize representing self number of gibibytes.
# File lib/bytesize/units.rb, line 177
Returns a new instance of ByteSize representing self number of kilobytes.
# File lib/bytesize/units.rb, line 77
Returns a new instance of IECByteSize representing self number of kibibytes.
# File lib/bytesize/units.rb, line 157
Returns a new instance of ByteSize representing self number of megabytes.
# File lib/bytesize/units.rb, line 87
Returns a new instance of IECByteSize representing self number of mebibytes.
# File lib/bytesize/units.rb, line 167
Returns a new instance of ByteSize representing self number of petabytes.
# File lib/bytesize/units.rb, line 117
Returns a new instance of IECByteSize representing self number of pebibytes.
# File lib/bytesize/units.rb, line 197
Returns a new instance of ByteSize representing self number of terabytes.
# File lib/bytesize/units.rb, line 107
Returns a new instance of IECByteSize representing self number of tebibytes.
# File lib/bytesize/units.rb, line 187
Returns a new instance of ByteSize representing self number of yottabytes.
# File lib/bytesize/units.rb, line 147
Returns a new instance of IECByteSize representing self number of yobibytes.
# File lib/bytesize/units.rb, line 227
Returns a new instance of ByteSize representing self number of zettabytes.
# File lib/bytesize/units.rb, line 137
Returns a new instance of IECByteSize representing self number of zebibytes.
# File lib/bytesize/units.rb, line 217