Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/cha_work/sugar/time.rb

Instance Method Summary collapse

Instance Method Details

#daysObject Also known as: day



45
46
47
# File 'lib/cha_work/sugar/time.rb', line 45

def days
  self.hours * 24
end

#hoursObject Also known as: hour



36
37
38
# File 'lib/cha_work/sugar/time.rb', line 36

def hours
  self * 3600
end

#in_daysObject



50
51
52
# File 'lib/cha_work/sugar/time.rb', line 50

def in_days
  self / 1.day.to_f
end

#in_hoursObject



41
42
43
# File 'lib/cha_work/sugar/time.rb', line 41

def in_hours
  self / 1.hour.to_f
end

#in_millisecondsObject



10
11
12
# File 'lib/cha_work/sugar/time.rb', line 10

def in_milliseconds
  self * 1000
end

#in_minutesObject



32
33
34
# File 'lib/cha_work/sugar/time.rb', line 32

def in_minutes
  self / 1.minute.to_f
end

#in_monthsObject



68
69
70
# File 'lib/cha_work/sugar/time.rb', line 68

def in_months
  self / 1.month.to_f
end

#in_secondsObject



21
22
23
# File 'lib/cha_work/sugar/time.rb', line 21

def in_seconds
  self
end

#in_weeksObject



59
60
61
# File 'lib/cha_work/sugar/time.rb', line 59

def in_weeks
  self / 1.week.to_f
end

#in_yearsObject



77
78
79
# File 'lib/cha_work/sugar/time.rb', line 77

def in_years
  self / 1.year.to_f
end

#millisecondsObject Also known as: millisecond, millisecs, millisec



3
4
5
# File 'lib/cha_work/sugar/time.rb', line 3

def milliseconds
  self / 1000.0
end

#minutesObject Also known as: minute, min, mins



25
26
27
# File 'lib/cha_work/sugar/time.rb', line 25

def minutes
  self * 60
end

#monthsObject Also known as: month



63
64
65
# File 'lib/cha_work/sugar/time.rb', line 63

def months
  self.days * 30
end

#secondsObject Also known as: second, sec, secs



14
15
16
# File 'lib/cha_work/sugar/time.rb', line 14

def seconds
  self
end

#weeksObject Also known as: week



54
55
56
# File 'lib/cha_work/sugar/time.rb', line 54

def weeks
  self.days * 7
end

#yearsObject Also known as: year



72
73
74
# File 'lib/cha_work/sugar/time.rb', line 72

def years
  self.days * 365
end