Class: SitemapGenerator::Numeric

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

Constant Summary

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

Instance Method Summary (collapse)

Constructor Details

- (Numeric) initialize(number)

Returns a new instance of Numeric



9
10
11
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 9

def initialize(number)
  @number = number
end

Instance Method Details

- (Object) bytes Also known as: byte

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



14
15
16
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 14

def bytes
  @number
end

- (Object) exabytes Also known as: exabyte



44
45
46
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 44

def exabytes
  @number * EXABYTE
end

- (Object) gigabytes Also known as: gigabyte



29
30
31
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 29

def gigabytes
  @number * GIGABYTE
end

- (Object) kilobytes Also known as: kilobyte



19
20
21
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 19

def kilobytes
  @number * KILOBYTE
end

- (Object) megabytes Also known as: megabyte



24
25
26
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 24

def megabytes
  @number * MEGABYTE
end

- (Object) petabytes Also known as: petabyte



39
40
41
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 39

def petabytes
  @number * PETABYTE
end

- (Object) terabytes Also known as: terabyte



34
35
36
# File 'lib/sitemap_generator/core_ext/numeric.rb', line 34

def terabytes
  @number * TERABYTE
end