Class: Numeric

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

Constant Summary collapse

SECONDS_PER_MINUTE =
60.0
SECONDS_PER_HOUR =
SECONDS_PER_MINUTE * 60
SECONDS_PER_DAY =
SECONDS_PER_HOUR * 24
SECONDS_PER_WEEK =
SECONDS_PER_DAY * 7
SECONDS_PER_MONTH =
SECONDS_PER_DAY * 30
SECONDS_PER_YEAR =
SECONDS_PER_DAY * 365.25

Instance Method Summary collapse

Instance Method Details

#daysObject Also known as: day



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

def days
  self * SECONDS_PER_DAY
end

#hoursObject Also known as: hour



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

def hours
  self * SECONDS_PER_HOUR
end

#minutesObject Also known as: minute



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

def minutes
  self * SECONDS_PER_MINUTE
end

#monthsObject Also known as: month



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

def months
  self * SECONDS_PER_MONTH
end

#secondsObject Also known as: second



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

def seconds
  self
end

#weeksObject Also known as: week



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

def weeks
  self * SECONDS_PER_WEEK
end

#yearsObject Also known as: year



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

def years
  self * SECONDS_PER_YEAR
end