Class: SitemapGenerator::Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/sitemap_generator/core_ext/numeric.rb

Constant Summary collapse

KILOBYTE =
1024
MEGABYTE =
KILOBYTE * 1024
GIGABYTE =
MEGABYTE * 1024
TERABYTE =
GIGABYTE * 1024
PETABYTE =
TERABYTE * 1024
EXABYTE =
PETABYTE * 1024

Instance Method Summary collapse

Constructor Details

#initialize(number) ⇒ Numeric

Returns a new instance of Numeric.



11
12
13
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 11

def initialize(number)
  @number = number
end

Instance Method Details

#bytesObject Also known as: byte

Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes



16
17
18
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 16

def bytes
  @number
end

#exabytesObject Also known as: exabyte



46
47
48
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 46

def exabytes
  @number * EXABYTE
end

#gigabytesObject Also known as: gigabyte



31
32
33
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 31

def gigabytes
  @number * GIGABYTE
end

#kilobytesObject Also known as: kilobyte



21
22
23
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 21

def kilobytes
  @number * KILOBYTE
end

#megabytesObject Also known as: megabyte



26
27
28
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 26

def megabytes
  @number * MEGABYTE
end

#petabytesObject Also known as: petabyte



41
42
43
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 41

def petabytes
  @number * PETABYTE
end

#terabytesObject Also known as: terabyte



36
37
38
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 36

def terabytes
  @number * TERABYTE
end