Module: Wristwatch::Intervals

Included in:
Schedule
Defined in:
lib/wristwatch/slices.rb,
lib/wristwatch/intervals.rb

Instance Method Summary collapse

Instance Method Details

#annuallyObject



47
48
49
# File 'lib/wristwatch/slices.rb', line 47

def annually
  daily and monthly and now.month.eql?(1)
end

#bi_dailyObject



15
16
17
# File 'lib/wristwatch/slices.rb', line 15

def bi_daily
  now.hour.divisible_by?(12)
end

#bi_hourlyObject



7
8
9
# File 'lib/wristwatch/slices.rb', line 7

def bi_hourly
  now.hour.divisible_by?(2)
end

#bi_monthlyObject



35
36
37
# File 'lib/wristwatch/slices.rb', line 35

def bi_monthly
  daily and monthly and now.month.divisible_by?(2, 1)
end

#bi_weeklyObject



27
28
29
# File 'lib/wristwatch/slices.rb', line 27

def bi_weekly
  daily and ( now.day.eql?(1) or now.day.eql?(15) )
end

#dailyObject



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

def daily
  now.hour.eql?(0)
end

#hourlyObject



3
4
5
# File 'lib/wristwatch/slices.rb', line 3

def hourly
  true
end

#monthlyObject



31
32
33
# File 'lib/wristwatch/slices.rb', line 31

def monthly
  daily and now.day.eql?(1)
end

#quarter_hourlyObject



11
12
13
# File 'lib/wristwatch/slices.rb', line 11

def quarter_hourly
  now.hour.divisible_by?(6)
end

#quarterlyObject



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

def quarterly
  daily and monthly and now.month.divisible_by?(3, 1)
end

#semiannuallyObject



43
44
45
# File 'lib/wristwatch/slices.rb', line 43

def semiannually
  daily and monthly and now.month.divisible_by?(6, 1)
end

#weeklyObject



23
24
25
# File 'lib/wristwatch/slices.rb', line 23

def weekly
  daily and now.wday.eql?(0)
end