Class: CalendariumRomanum::Rank

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/calendarium-romanum/rank.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(priority = nil, desc = nil, short_desc = nil) ⇒ Rank

Returns a new instance of Rank.


5
6
7
8
9
# File 'lib/calendarium-romanum/rank.rb', line 5

def initialize(priority=nil, desc=nil, short_desc=nil)
  @priority = priority
  @desc = desc
  @short_desc = short_desc
end

Instance Attribute Details

#priorityObject (readonly) Also known as: to_f

Returns the value of attribute priority


11
12
13
# File 'lib/calendarium-romanum/rank.rb', line 11

def priority
  @priority
end

Instance Method Details

#<=>(b) ⇒ Object


24
25
26
# File 'lib/calendarium-romanum/rank.rb', line 24

def <=>(b)
  b.priority <=> self.priority
end

#descObject Also known as: to_s


14
15
16
# File 'lib/calendarium-romanum/rank.rb', line 14

def desc
  @desc && I18n.t(@desc)
end

#feast?Boolean

Returns:

  • (Boolean)

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

def feast?
  priority.to_i == 2
end

#memorial?Boolean

Returns:

  • (Boolean)

36
37
38
# File 'lib/calendarium-romanum/rank.rb', line 36

def memorial?
  priority.to_i == 3
end

#short_descObject


20
21
22
# File 'lib/calendarium-romanum/rank.rb', line 20

def short_desc
  @short_desc && I18n.t(@short_desc)
end

#solemnity?Boolean

Returns:

  • (Boolean)

28
29
30
# File 'lib/calendarium-romanum/rank.rb', line 28

def solemnity?
  priority.to_i == 1
end