Class: Numeric

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

Instance Method Summary collapse

Instance Method Details

#amObject



42
43
44
# File 'lib/days_and_times/numeric.rb', line 42

def am
  Time.parse("#{self}:00:00")
end

#dayObject



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

def day
  self.days
end

#daysObject



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

def days
  self == 1 ? Day.new : Days.new(self)
end

#hourObject



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

def hour
  self.hours
end

#hoursObject



17
18
19
# File 'lib/days_and_times/numeric.rb', line 17

def hours
  self == 1 ? Hour.new : Hours.new(self)
end

#is_multiple_of?(num) ⇒ Boolean

Returns:

  • (Boolean)


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

def is_multiple_of?(num)
  self % num == 0
end

#minuteObject



27
28
29
# File 'lib/days_and_times/numeric.rb', line 27

def minute
  self.minutes
end

#minutesObject



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

def minutes
  self == 1 ? Minute.new : Minutes.new(self)
end

#pmObject



45
46
47
# File 'lib/days_and_times/numeric.rb', line 45

def pm
  Time.parse("#{self+12}:00:00")
end

#secondObject



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

def second
  self.seconds
end

#secondsObject



31
32
33
# File 'lib/days_and_times/numeric.rb', line 31

def seconds
  self == 1 ? Second.new : Seconds.new(self)
end

#weekObject



6
7
8
# File 'lib/days_and_times/numeric.rb', line 6

def week
  self.weeks
end

#weeksObject



3
4
5
# File 'lib/days_and_times/numeric.rb', line 3

def weeks
  self == 1 ? Week.new : Weeks.new(self)
end