Numeric (original) (raw)

Methods

B

D

E

F

G

H

I

K

M

P

S

T

W

Z

Constants

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

Instance Public methods

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

2.bytes

Also aliased as: byte

Returns a Duration instance matching the number of days provided.

2.days

Also aliased as: day

Source: show | on GitHub

def days ActiveSupport::Duration.days(self) end

Returns the number of bytes equivalent to the exabytes provided.

2.exabytes

Returns a Duration instance matching the number of fortnights provided.

2.fortnights

Source: show | on GitHub

def fortnights ActiveSupport::Duration.weeks(self * 2) end

Returns the number of bytes equivalent to the gigabytes provided.

2.gigabytes

Returns a Duration instance matching the number of hours provided.

2.hours

Also aliased as: hour

Source: show | on GitHub

def hours ActiveSupport::Duration.hours(self) end

Returns the number of milliseconds equivalent to the seconds provided. Used with the standard time durations.

2.in_milliseconds 1.hour.in_milliseconds

Returns the number of bytes equivalent to the kilobytes provided.

2.kilobytes

Returns the number of bytes equivalent to the megabytes provided.

2.megabytes

Returns a Duration instance matching the number of minutes provided.

2.minutes

Source: show | on GitHub

def minutes ActiveSupport::Duration.minutes(self) end

Returns the number of bytes equivalent to the petabytes provided.

2.petabytes

Returns a Duration instance matching the number of seconds provided.

2.seconds

Source: show | on GitHub

def seconds ActiveSupport::Duration.seconds(self) end

Returns the number of bytes equivalent to the terabytes provided.

2.terabytes

Returns a Duration instance matching the number of weeks provided.

2.weeks

Also aliased as: week

Source: show | on GitHub

def weeks ActiveSupport::Duration.weeks(self) end

Returns the number of bytes equivalent to the zettabytes provided.

2.zettabytes