Class: Linguistics::Latin::Verb::LatinVerb::TenseMethodApplicator::MutatorForVerbType::FirstBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/latinverb/tense_method_applicator/first_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(verb) ⇒ FirstBuilder

Returns a new instance of FirstBuilder.



8
9
10
# File 'lib/latinverb/tense_method_applicator/first_builder.rb', line 8

def initialize(verb)
  @verb = verb
end

Instance Method Details

#build!Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/latinverb/tense_method_applicator/first_builder.rb', line 12

def build!
  @verb.instance_eval do
    def active_voice_indicative_mood_future_tense
      return TenseBlock.new(
        [AF_ONE_TWO_ENDINGS.collect{|x| stem + x}].flatten,
        { :meaning => MEANINGS[:active_voice_indicative_mood_future_tense] }
      )
    end

    def active_voice_indicative_mood_imperfect_tense
      return TenseBlock.new(
        [AI_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS.collect{|x| stem + x}].flatten,
        { :meaning => MEANINGS[:active_voice_indicative_mood_imperfect_tense] }
      )
    end

    def active_voice_indicative_mood_present_tense
      return TenseBlock.new(
           [ first_person_singular, AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS.collect{ |ending| stem + ending} ].flatten,
        { :meaning => MEANINGS[:active_voice_indicative_mood_present_tense] }
        )
    end

    def active_voice_subjunctive_mood_present_tense
      key = verb_type.ordinal_name_key
      asp_base     = stem[0..-2] + ACTIVE_PRESENT_SUBJUNCTIVE_ENDINGS[key]
      endings_coll = ['m', AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!
      collection   = endings_coll.map{ |ending| asp_base + ending }
      TenseBlock.new(
        collection,
        { :meaning => Linguistics::Latin::Verb::MEANINGS[:active_voice_subjunctive_mood_present_tense] }
        )
    end

    def passive_voice_indicative_mood_future_tense
      fp_stem   = stem + "bi"
      standards = PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG[2..-1].map{|x| fp_stem + x}
      standards.pop
      fp_stem.sub!(/.$/,'u')
      collection =
        [ stem + "b\xc5\x8dr",
          stem + "beris",
          standards,
          fp_stem + PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.last].flatten!

      TenseBlock.new(
        collection,
        { :meaning => MEANINGS[:passive_voice_indicative_mood_future_tense] }
        )
    end

    def passive_voice_indicative_mood_imperfect_tense
      imperfect_stem = stem + "b\xc4\x81"
      collection = PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map{|x| imperfect_stem + x}
      return TenseBlock.new(
        collection,
        { :meaning => MEANINGS[:passive_voice_indicative_mood_imperfect_tense] }
        )
    end

    def passive_voice_indicative_mood_present_tense
      local_pe = PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.clone
      collection = [first_person_singular.to_s + "r", local_pe[1..-1].map{|x| stem + x}].flatten
      return TenseBlock.new(
        collection,
        { :meaning => MEANINGS[:passive_voice_indicative_mood_present_tense] }
        )
    end

    def passive_voice_subjunctive_mood_present_tense
      key = verb_type.ordinal_name_key
      short_base = stem[0..-2] + ACTIVE_PRESENT_SUBJUNCTIVE_ENDINGS[key]
      collection = PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map { |ending| short_base + ending }
      TenseBlock.new(
        collection,
        { :meaning => MEANINGS[:passive_voice_subjunctive_mood_present_tense] }
        )
    end
  end
end