class JayVerb

Attributes

base[RW]
causative_dictionary_form[RW]
causative_forms[RW]
causative_forms_hiragana[RW]
causative_forms_romaji[RW]
causative_passive_dictionary_form[RW]
causative_passive_forms[RW]
causative_passive_forms_hiragana[RW]
causative_passive_forms_romaji[RW]
conjugations[RW]
has_causative[RW]
has_causative_passive[RW]
has_imperative[RW]
has_passive[RW]
has_volitional[RW]
hiragana[RW]
hiragana_forms[RW]
kanji[RW]
negative_stem[RW]
part_of_speech[RW]
passive_dictionary_form[RW]
passive_forms[RW]
passive_forms_hiragana[RW]
passive_forms_romaji[RW]
romaji[RW]
romaji_forms[RW]
stem_form[RW]

Public Class Methods

new(kanji, hiragana) click to toggle source
# File lib/jay_verb.rb, line 22
def initialize(kanji, hiragana)
  @kanji = kanji
  @hiragana = hiragana
  @romaji = Japanese::ToRomaji.convert_hiragana(String.new(hiragana))
  @part_of_speech = self.resolve_verb_class
  self.set_verb_behavior_types
  @hiragana_forms = {}
  @romaji_forms = {}
  @passive_forms = {}
  @causative_forms = {}
  @conjugations = {}
  @causative_passive_forms = {}
  @causative_passive_forms_hiragana = {}
  @causative_passive_forms_romaji = {}
  @passive_forms_hiragana = {}
  @passive_forms_romaji ={}
  @causative_forms_hiragana = {}
  @causative_forms_romaji = {}
  self.process_verb
end

Public Instance Methods

set_verb_behavior_types() click to toggle source

Defaults all has_* attributes to true for now. When self.process_verb is called, this will conjugate the verb for all possible modes. This may not make sense for all verbs —- for example, some verbs may never be realistically used in the imperative sense, such as “存在しろ!” (“Exist!”), which while grammatically correct, may sound nonsensical.

# File lib/jay_verb.rb, line 48
def set_verb_behavior_types
  if part_of_speech.in?(%w(v1 v5b v5g v5k v5k-s v5m v5n v5r v5r-i v5s v5t v5u v5u-s v-aru v-kuru v-suru))
    attrs = %w(imperative passive volitional causative causative_passive)
    attrs.each do |a|
      unless self.send("has_#{a}") == false
        eval "self.has_#{a} = true"
      end
    end
  end
end