Class: LLT::PraesensBuilder

Inherits:
VerbBuilder show all
Defined in:
lib/llt/form_builder/praesens_builder.rb

Direct Known Subclasses

IrregularPraesensBuilder

Constant Summary collapse

PASSIVE_INDICES =
passive_indices

Constants inherited from FormBuilder

FormBuilder::VERSION

Instance Attribute Summary

Attributes inherited from FormBuilder

#impersonalium

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from VerbBuilder

#contraction, #endings_namespace, #genus_index, #new_form_through_index, #persona_index, #regular_forms

Methods inherited from FormBuilder

#attributes_by_index, build, #compute, #cross_indices, #default_args, #downcase_all_stems, #endings, #endings_attributes, #endings_container, #endings_lookup, #endings_namespace, #endings_path, #extensions_and_other_signs, #form_class, #init_keys, #initialize, #keep_given_value, lookup_class, #lookup_indices, #needs_validation?, #new_form, #prefix, #reverse_lookup, #stays_capitalized, #stem_copy, #valid?, #validation_rule, validations, #validations, #value_as_index

Constructor Details

This class inherits a constructor from LLT::FormBuilder

Class Method Details

.passive_indicesObject



26
27
28
29
30
# File 'lib/llt/form_builder/praesens_builder.rb', line 26

def self.passive_indices
  # build all possible indices, slice them according to their genus, select only even ones,
  # i.e. the passive endings
  (0..107).each_slice(6).each_with_index.each_with_object([]) { |(e, i), r| r << e if i.odd? }.flatten
end

Instance Method Details

#corrections(args) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/llt/form_builder/praesens_builder.rb', line 33

def corrections(args)
  if args[:inflection_class] == 1
    if args[:tempus] == t.pr && (args[:modus] == t.con || args[:ending].match(/or?$/))
      args[:stem] = args[:stem].chop
    end
  end
end

#indicesObject



7
8
9
10
11
12
13
14
# File 'lib/llt/form_builder/praesens_builder.rb', line 7

def indices
  { persona: persona_index,
    numerus: [0, 3],
    genus:   genus_index,
    modus:   [0, 12, 24],
    tempus:  [0, 36, 72]
  }
end

#indices_by_ending(ending) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/llt/form_builder/praesens_builder.rb', line 16

def indices_by_ending(ending)
  indices = super
  if @deponens
    PASSIVE_INDICES & indices
  else
    indices
  end
end