Class: CalendariumRomanum::Day
- Inherits:
-
Object
- Object
- CalendariumRomanum::Day
- Defined in:
- lib/calendarium-romanum/day.rb
Overview
information on one particular day of the liturgical year
Instance Attribute Summary collapse
-
#celebrations ⇒ Object
readonly
an Array of Celebrations, possibly empty.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#season ⇒ Object
readonly
one of the Seasons (Symbol).
-
#season_week ⇒ Object
readonly
week of the season (Integer).
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(args = {}) ⇒ Day
constructor
A new instance of Day.
- #weekday ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Day
Returns a new instance of Day.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/calendarium-romanum/day.rb', line 7 def initialize(args={}) %i(date season season_week celebrations).each do |a| if args.include? a instance_variable_set "@#{a}", args.delete(a) end end unless args.empty? raise ArgumentError.new "Unexpected arguments #{args.keys.join(', ')}" end end |
Instance Attribute Details
#celebrations ⇒ Object (readonly)
an Array of Celebrations, possibly empty
32 33 34 |
# File 'lib/calendarium-romanum/day.rb', line 32 def celebrations @celebrations end |
#date ⇒ Object (readonly)
Returns the value of attribute date
19 20 21 |
# File 'lib/calendarium-romanum/day.rb', line 19 def date @date end |
#season ⇒ Object (readonly)
one of the Seasons (Symbol)
26 27 28 |
# File 'lib/calendarium-romanum/day.rb', line 26 def season @season end |
#season_week ⇒ Object (readonly)
week of the season (Integer)
29 30 31 |
# File 'lib/calendarium-romanum/day.rb', line 29 def season_week @season_week end |
Instance Method Details
#==(other) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/calendarium-romanum/day.rb', line 34 def ==(other) self.class == other.class && date == other.date && season == other.season && season_week == other.season_week && celebrations == other.celebrations end |
#weekday ⇒ Object
21 22 23 |
# File 'lib/calendarium-romanum/day.rb', line 21 def weekday date.wday end |