class Numeric

def as_json(options = nil) # :nodoc:

:nodoc:
def as_json(options = nil) # :nodoc:
  self
end

def blank?

Returns:
  • (false) -
def blank?
  false
end

def bytes

2.bytes # => 2

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

def days

2.days # => 2 days

Returns a Duration instance matching the number of days provided.
def days
  ActiveSupport::Duration.days(self)
end

def exabytes

2.exabytes # => 2_305_843_009_213_693_952

Returns the number of bytes equivalent to the exabytes provided.
def exabytes
  self * EXABYTE
end

def fortnights

2.fortnights # => 4 weeks

Returns a Duration instance matching the number of fortnights provided.
def fortnights
  ActiveSupport::Duration.weeks(self * 2)
end

def gigabytes

2.gigabytes # => 2_147_483_648

Returns the number of bytes equivalent to the gigabytes provided.
def gigabytes
  self * GIGABYTE
end

def hours

2.hours # => 2 hours

Returns a Duration instance matching the number of hours provided.
def hours
  ActiveSupport::Duration.hours(self)
end

def html_safe?

def html_safe?
  true
end

def in_milliseconds

1.hour.in_milliseconds # => 3600000
2.in_milliseconds # => 2000

Used with the standard time durations.
Returns the number of milliseconds equivalent to the seconds provided.
def in_milliseconds
  self * 1000
end

def kilobytes

2.kilobytes # => 2048

Returns the number of bytes equivalent to the kilobytes provided.
def kilobytes
  self * KILOBYTE
end

def megabytes

2.megabytes # => 2_097_152

Returns the number of bytes equivalent to the megabytes provided.
def megabytes
  self * MEGABYTE
end

def minutes

2.minutes # => 2 minutes

Returns a Duration instance matching the number of minutes provided.
def minutes
  ActiveSupport::Duration.minutes(self)
end

def petabytes

2.petabytes # => 2_251_799_813_685_248

Returns the number of bytes equivalent to the petabytes provided.
def petabytes
  self * PETABYTE
end

def seconds

2.seconds # => 2 seconds

Returns a Duration instance matching the number of seconds provided.
def seconds
  ActiveSupport::Duration.seconds(self)
end

def terabytes

2.terabytes # => 2_199_023_255_552

Returns the number of bytes equivalent to the terabytes provided.
def terabytes
  self * TERABYTE
end

def weeks

2.weeks # => 2 weeks

Returns a Duration instance matching the number of weeks provided.
def weeks
  ActiveSupport::Duration.weeks(self)
end

def zettabytes

2.zettabytes # => 2_361_183_241_434_822_606_848

Returns the number of bytes equivalent to the zettabytes provided.
def zettabytes
  self * ZETTABYTE
end