Module: Holidays::Definition::CustomMethods::AR

Defined in:
lib/holidays/definition/custom_methods/ar.rb

Overview

ar custom holiday calculations, ported verbatim from the methods: block in definitions/ar.yaml.

Class Method Summary collapse

Class Method Details

.to_nearest_monday(date) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/holidays/definition/custom_methods/ar.rb', line 10

def to_nearest_monday(date)
  case date.wday
  when 5
    date += 3
  when 4
    date += 4
  when 3
    date -= 2
  when 2
    date -= 1
  end

  date
end