Class: CalendariumRomanum::Day

Inherits:
Object
  • Object
show all
Defined in:
lib/calendarium-romanum/day.rb

Overview

information on one particular day of the liturgical year

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#celebrationsObject (readonly)

an Array of Celebrations, possibly empty


32
33
34
# File 'lib/calendarium-romanum/day.rb', line 32

def celebrations
  @celebrations
end

#dateObject (readonly)

Returns the value of attribute date


19
20
21
# File 'lib/calendarium-romanum/day.rb', line 19

def date
  @date
end

#seasonObject (readonly)

one of the Seasons (Symbol)


26
27
28
# File 'lib/calendarium-romanum/day.rb', line 26

def season
  @season
end

#season_weekObject (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

#weekdayObject


21
22
23
# File 'lib/calendarium-romanum/day.rb', line 21

def weekday
  date.wday
end