Class: EasterVoice

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

Instance Method Summary collapse

Constructor Details

#initialize(future: false) ⇒ EasterVoice

Returns a new instance of EasterVoice.



106
107
108
# File 'lib/easter.rb', line 106

def initialize(future: false)
  @future = future
end

Instance Method Details

#ascension_dayObject



111
# File 'lib/easter.rb', line 111

def ascension_day() date :ascension_day, 'Ascension day' end

#ash_wednesdayObject



112
# File 'lib/easter.rb', line 112

def ash_wednesday() date :ash_wednesday, 'Ash Wednesday' end

#easterObject



110
# File 'lib/easter.rb', line 110

def easter()        date :easter                         end

#easter_datesObject



119
120
121
122
# File 'lib/easter.rb', line 119

def easter_dates()
  %i(ash_wednesday palm_sunday good_friday easter ascension_day  pentecost)\
      .map {|day| method(day).call }.join("\n")
end

#good_fridayObject



113
# File 'lib/easter.rb', line 113

def good_friday()   date :good_friday,   'Good Friday'   end

#holy_saturdayObject



115
# File 'lib/easter.rb', line 115

def holy_saturday() date :holy_saturday, 'Holy Saturday' end

#holy_thursdayObject



114
# File 'lib/easter.rb', line 114

def holy_thursday() date :holy_thursday, 'Holy Thursday' end

#lentObject



128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/easter.rb', line 128

def lent()
  
  participle = case Date.today
  when (Easter.ash_wednesday..Easter.holy_thursday) then 'is'      
  when (Date.new(Date.year)..Easter.ash_wednesday) then 'will be'
  else 
    'was'
  end
  
  days =  %i(ash_wednesday holy_thursday)\
      .map {|x| Easter.method(x).call.humanize(year: true).sub(/on /,'') }
  "Lent %s from %s to %s." % [participle, *days]
end

#lent_endObject



126
# File 'lib/easter.rb', line 126

def lent_end()   date :holy_thursday, 'The end of Lent'    end

#lent_startObject



125
# File 'lib/easter.rb', line 125

def lent_start() date :ash_wednesday, 'Lent'               end

#palm_sundayObject



116
# File 'lib/easter.rb', line 116

def palm_sunday()   date :palm_sunday,   'Palm Sunday'   end

#pentecostObject



117
# File 'lib/easter.rb', line 117

def pentecost()     date :pentecost,     'Pentecost'     end