diff --git a/lib/ika_conjugations/verb.rb b/lib/ika_conjugations/verb.rb index c0c6cba..81f4f65 100644 --- a/lib/ika_conjugations/verb.rb +++ b/lib/ika_conjugations/verb.rb @@ -73,6 +73,10 @@ module IkaConjugations negative_stem + "よう" end + def passive + Ichidan.new(passive_starter.kanji, passive_starter.kana, "#{definition} (dissatisfied)") + end + class Ichidan < Verb def stem all_but_last_character @@ -93,6 +97,10 @@ module IkaConjugations def ba stem + "れば" end + + def passive_starter + stem + "られる" + end end class Godan < Verb @@ -152,6 +160,10 @@ module IkaConjugations def ba all_but_last_character + last_character("e") + "ば" end + + def passive_starter + all_but_last_character + last_character("a") + "れる" + end end class Suru < Verb @@ -178,6 +190,10 @@ module IkaConjugations def ba prefix + "すれば" end + + def passive_starter + prefix + "される" + end end class Kuru < Verb @@ -204,6 +220,10 @@ module IkaConjugations def ba prefix + KanaKanji.new("く", "来") + "れば" end + + def passive_starter + prefix + KanaKanji.new("こ", "来") + "られる" + end end end end diff --git a/test/ika_conjugations/test_verb.rb b/test/ika_conjugations/test_verb.rb index 4787be3..71b8813 100644 --- a/test/ika_conjugations/test_verb.rb +++ b/test/ika_conjugations/test_verb.rb @@ -249,5 +249,18 @@ module IkaConjugations assert_equal "あれば", @aru.ba.kanji assert_equal "会えば", @au.ba.kanji end + + def test_passive + assert_equal "見られる", @miru.passive.dictionary.kanji + assert_equal "飲まれる", @nomu.passive.dictionary.kanji + assert_equal "される", @suru.passive.dictionary.kanji + assert_equal "勉強される", @benkyousuru.passive.dictionary.kanji + assert_equal "来られる", @kuru.passive.dictionary.kanji + assert_equal "こられる", @kuru.passive.dictionary.kana + assert_equal "連れて来られる", @tsuretekuru.passive.dictionary.kanji + assert_equal "つれてこられる", @tsuretekuru.passive.dictionary.kana + assert_equal "あられる", @aru.passive.dictionary.kanji + assert_equal "会われる", @au.passive.dictionary.kanji + end end end