Class: Katsuyoujin::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/katsuyoujin/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(verb, base_letter) ⇒ Base

Returns a new instance of Base.



5
6
7
8
# File 'lib/katsuyoujin/base.rb', line 5

def initialize(verb, base_letter)
  @verb = verb
  @base_letter = base_letter
end

Instance Attribute Details

#base_letterObject (readonly)

Returns the value of attribute base_letter.



3
4
5
# File 'lib/katsuyoujin/base.rb', line 3

def base_letter
  @base_letter
end

#verbObject (readonly)

Returns the value of attribute verb.



3
4
5
# File 'lib/katsuyoujin/base.rb', line 3

def verb
  @verb
end

Instance Method Details

#conjugate(category: nil, hiragana: true) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/katsuyoujin/base.rb', line 10

def conjugate(category: nil, hiragana: true)
  case category || verb.category
  when 'ichidan' then ichidan_base(base_letter, hiragana: hiragana)
  when 'godan' then godan_base(base_letter, hiragana: hiragana)
  when 'suru', 'kuru' then irregular_base(base_letter, hiragana: hiragana)
  end
end