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

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

.eto_hashObject

get eto eto_hash



33
34
35
# File 'lib/eto.rb', line 33

def eto_hash
  HASH
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

.namesObject

get eto names



28
29
30
# File 'lib/eto.rb', line 28

def names
  JAPANESE_ZODIAC_NAMES
end