Class: BahaiDate::Month

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

Constant Summary collapse

TITLES =
%w(Baha Jalal Jamal Azamat Nur Rahmat Kalimat Kamal Asma Izzat Mashiyyat Ilm Qudrat Qawl Masail Sharaf Sultan Mulk Ala Ayyam-i-Ha)
TITLES_HTML =
%w(Bahá Jalál Jamál ‘Aẓamat Núr Raḥmat Kalimát Kamál Asmá’ ‘Izzat Ma<u>sh</u>íyyat ‘Ilm Qudrat Qawl Masá’il <u>Sh</u>araf Sulṭán Mulk ‘Alá’ Ayyám-i-Há)
TITLES_EN =
%w(Splendour Glory Beauty Grandeur Light Mercy Words Perfection Names Might Will Knowledge Power Speech Questions Honour Sovereignty Dominion Loftiness Ayyam-i-Ha)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(number_arg) ⇒ Month

Returns a new instance of Month.



9
10
11
12
13
# File 'lib/bahai_date/month.rb', line 9

def initialize(number_arg)
  validate number_arg
  @number = number_arg.to_i
  @days = {}
end

Instance Attribute Details

#daysObject (readonly)

Returns the value of attribute days.



7
8
9
# File 'lib/bahai_date/month.rb', line 7

def days
  @days
end

#numberObject (readonly)

Returns the value of attribute number.



7
8
9
# File 'lib/bahai_date/month.rb', line 7

def number
  @number
end

Instance Method Details

#add_day(day_number) ⇒ Object



31
32
33
34
# File 'lib/bahai_date/month.rb', line 31

def add_day(day_number)
  return if @days[day_number]
  @days[day_number] = Day.new(day_number)
end

#htmlObject



27
28
29
# File 'lib/bahai_date/month.rb', line 27

def html
  TITLES_HTML[title_index]
end

#titleObject



19
20
21
# File 'lib/bahai_date/month.rb', line 19

def title
  TITLES[title_index]
end

#to_sObject



15
16
17
# File 'lib/bahai_date/month.rb', line 15

def to_s
  title
end

#translationObject



23
24
25
# File 'lib/bahai_date/month.rb', line 23

def translation
  TITLES_EN[title_index]
end