Class: DateTime

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

Instance Method Summary collapse

Instance Method Details

#redday?Boolean

Returns:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/russian_holidays_checkup/extended.rb', line 23

def redday?
  all_russian_holidays = [
      Date.new(2015, 1, 1),
      Date.new(2015, 1, 2),
      Date.new(2015, 1, 5),
      Date.new(2015, 1, 6),
      Date.new(2015, 1, 7),
      Date.new(2015, 1, 8),
      Date.new(2015, 1, 9),
      Date.new(2015, 2, 23),
      Date.new(2015, 3, 9),
      Date.new(2015, 5, 1),
      Date.new(2015, 5, 4),
      Date.new(2015, 5, 11),
      Date.new(2015, 6, 12),
      Date.new(2015, 11, 4)
  ]

  ((6..7).include? self.strftime('%u').to_i) || all_russian_holidays.index(self.to_date) ? true : false
end

#russian_holiday?Boolean

Returns:



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/russian_holidays_checkup/extended.rb', line 2

def russian_holiday?
  all_russian_holidays = [
      Date.new(2015, 1, 1),
      Date.new(2015, 1, 2),
      Date.new(2015, 1, 5),
      Date.new(2015, 1, 6),
      Date.new(2015, 1, 7),
      Date.new(2015, 1, 8),
      Date.new(2015, 1, 9),
      Date.new(2015, 2, 23),
      Date.new(2015, 3, 9),
      Date.new(2015, 5, 1),
      Date.new(2015, 5, 4),
      Date.new(2015, 5, 11),
      Date.new(2015, 6, 12),
      Date.new(2015, 11, 4)
  ]

  all_russian_holidays.index(self.to_date).nil? ? false : true
end