Class: Numeric

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

Instance Method Summary collapse

Instance Method Details

#ddayObject



32
33
34
# File 'lib/duration/numeric.rb', line 32

def dday
  self.ddays
end

#ddaysObject



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

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

#dhourObject



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

def dhour
  self.dhours
end

#dhoursObject



36
37
38
# File 'lib/duration/numeric.rb', line 36

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

#dminuteObject



46
47
48
# File 'lib/duration/numeric.rb', line 46

def dminute
  self.dminutes
end

#dminutesObject



43
44
45
# File 'lib/duration/numeric.rb', line 43

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

#dmonthObject



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

def dmonth
  self.dmonths
end

#dmonthsObject



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

def dmonths
  self == 1 ? Month.new : Months.new(self)
end

#dsecondObject



53
54
55
# File 'lib/duration/numeric.rb', line 53

def dsecond
  self.dseconds
end

#dsecondsObject



50
51
52
# File 'lib/duration/numeric.rb', line 50

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

#durationObject



4
5
6
# File 'lib/duration/numeric.rb', line 4

def duration
  Duration.new self
end

#dweekObject



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

def dweek
  self.dweeks
end

#dweeksObject



22
23
24
# File 'lib/duration/numeric.rb', line 22

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

#dyearObject



11
12
13
# File 'lib/duration/numeric.rb', line 11

def dyear
  self.dyears
end

#dyearsObject



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

def dyears
  self == 1 ? Year.new : Years.new(self)
end

#is_multiple_of?(num) ⇒ Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/duration/numeric.rb', line 57

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