Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/bytesize/units.rb

Overview

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)