Method: Date#pascoa
- Defined in:
- lib/brdata/feriado.rb
#pascoa ⇒ Object
Retorna a pascoa no ano da data atual
Exemplo:
data = Date.new(2007, 12, 25)
data.pascoa ==> "2007-4-8"
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/brdata/feriado.rb', line 66 def pascoa g = self.year % 19 c = (self.year / 100).floor h = (c - ( c / 4 ).floor - ((8 * c) / 25).floor + 19 * g + 15) % 30 i = h - (h / 28).floor * (1 - (h / 28).floor * (29 / (h + 1)).floor * ((21 - g) / 11).floor) j = (self.year + (self.year/ 4).floor + i + 2 - c + (c / 4).floor) % 7 l = i - j month = 3 + ((l + 40) / 44).floor day = l + 28 - (31 * (month / 4 ).floor) Date.parse("#{self.year}-#{month}-#{day}") end |