Module: Eto
- Defined in:
- lib/eto.rb,
lib/eto/version.rb
Overview
Eto
Constant Summary collapse
- TEN_CALENDAR_SIGNS =
十干
%w(庚 辛 壬 癸 甲 乙 丙 丁 戊 己).freeze
- JAPANESE_ZODIAC_NAMES =
十二支
%w(子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥).freeze
- HASH =
Eto Hash ( EtoName => EtoEmoji )
{ '子' => ':mouse:', '丑' => ':cow:', '寅' => ':tiger:', '卯' => ':rabbit:', '辰' => ':dragon:', '巳' => ':snake:', '午' => ':horse:', '未' => ':sheep:', '申' => ':monkey:', '酉' => ':chicken:', '戌' => ':dog:', '亥' => ':boar:' }.freeze
- VERSION =
'1.0.1'
Class Method Summary collapse
-
.emoji(year) ⇒ Object
get eto emoji from year.
-
.eto_hash ⇒ Object
get eto eto_hash.
-
.name(year, japanese_zodiac = true) ⇒ Object
get eto name from year.
-
.names ⇒ Object
get eto names.
Class Method Details
.emoji(year) ⇒ Object
get eto emoji from year
47 48 49 50 |
# File 'lib/eto.rb', line 47 def emoji(year) int_year = validate_year(year) HASH[name(int_year)] end |
.name(year, japanese_zodiac = true) ⇒ Object
get eto name from year
38 39 40 41 42 43 44 |
# File 'lib/eto.rb', line 38 def name(year, japanese_zodiac = true) int_year = validate_year(year) japanese_zodiac_text = JAPANESE_ZODIAC_NAMES[(int_year + 8) % 12] return japanese_zodiac_text if japanese_zodiac ten_calendar_signs_text = TEN_CALENDAR_SIGNS[(int_year) % 10] "#{ten_calendar_signs_text}#{japanese_zodiac_text}" end |
.names ⇒ Object
get eto names
28 29 30 |
# File 'lib/eto.rb', line 28 def names JAPANESE_ZODIAC_NAMES end |