class CalendariumRomanum::Rank
Celebration
rank
Attributes
priority[R]
@return [Float, nil]
to_f[R]
@return [Float, nil]
Public Class Methods
new(priority = nil, desc = nil, short_desc = nil)
click to toggle source
@param priority [Float, nil] number in the Table of Liturgical Days @param desc [String, nil]
full description (translation string identifier)
@param short_desc
[String, nil]
short rank name (translation string identifier)
# File lib/calendarium-romanum/rank.rb, line 12 def initialize(priority = nil, desc = nil, short_desc = nil) @priority = priority @desc = desc @short_desc = short_desc end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/calendarium-romanum/rank.rb, line 46 def <=>(other) other.priority <=> priority end
desc()
click to toggle source
Full description - internationalized human-readable string.
@return [String, nil]
# File lib/calendarium-romanum/rank.rb, line 25 def desc @desc && I18n.t(@desc) end
short_desc()
click to toggle source
Short name - internationalized human-readable string.
@return [String, nil]
# File lib/calendarium-romanum/rank.rb, line 42 def short_desc @short_desc && I18n.t(@short_desc) end
succ()
click to toggle source
Returns the next higher rank.
Allows constructing ranges of ranks.
@return [Rank] @since 0.8.0
# File lib/calendarium-romanum/rank.rb, line 56 def succ all = CR::Ranks.all index = all.index(self) raise StopIteration.new if index == 0 all[index - 1] end
to_s()
click to toggle source
String representation mostly for debugging purposes.
@return [String]
# File lib/calendarium-romanum/rank.rb, line 32 def to_s # 'desc' instead of '@desc' is intentional - # for a good reason we don't present contents of an instance # variable but result of an instance method "#<#{self.class.name} @priority=#{priority} desc=#{desc.inspect}>" end
Private Instance Methods
rank()
click to toggle source
Required by the {RankPredicates} mixin
# File lib/calendarium-romanum/rank.rb, line 67 def rank self end