Class: LLT::Form

Inherits:
Object
  • Object
show all
Includes:
Helpers::Constantize, Helpers::Functions, Helpers::Initialize, Helpers::Metrical, Helpers::Normalizer
Defined in:
lib/llt/form.rb,
lib/llt/form/fp.rb,
lib/llt/form/ppa.rb,
lib/llt/form/ppp.rb,
lib/llt/form/noun.rb,
lib/llt/form/verb.rb,
lib/llt/form/adverb.rb,
lib/llt/form/ethnic.rb,
lib/llt/form/gerund.rb,
lib/llt/form/pronoun.rb,
lib/llt/form/supinum.rb,
lib/llt/form/cardinal.rb,
lib/llt/form/adjective.rb,
lib/llt/form/gerundive.rb,
lib/llt/form/declinable.rb,
lib/llt/form/infinitive.rb,
lib/llt/form/participle.rb,
lib/llt/form/conjunction.rb,
lib/llt/form/preposition.rb,
lib/llt/form/subjunction.rb,
lib/llt/form/verbal_noun.rb,
lib/llt/form/uninflectable.rb,
lib/llt/form/personal_pronoun.rb,
lib/llt/form/relative_pronoun.rb,
lib/llt/form/indefinite_pronoun.rb,
lib/llt/form/demonstrative_pronoun.rb,
lib/llt/form/interrogative_pronoun.rb

Defined Under Namespace

Classes: Adjective, Adverb, Cardinal, Conjunction, Declinable, DemonstrativePronoun, Ethnic, Fp, Gerund, Gerundive, IndefinitePronoun, Infinitive, InterrogativePronoun, Noun, Participle, PersonalPronoun, Ppa, Ppp, Preposition, Pronoun, RelativePronoun, Subjunction, Supinum, Uninflectable, Verb, VerbalNoun

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Form

Returns a new instance of Form.



41
42
43
44
45
# File 'lib/llt/form.rb', line 41

def initialize(args)
  extract_args!(args)
  @string = args[:string] || segments.join # a custom string might be present for irregular forms
  evaluate_metrical_presence(@string)
end

Instance Attribute Details

#casusObject

Returns the value of attribute casus.



37
38
39
# File 'lib/llt/form.rb', line 37

def casus
  @casus
end

#classificationObject

Returns the value of attribute classification.



37
38
39
# File 'lib/llt/form.rb', line 37

def classification
  @classification
end

#comparison_signObject

Returns the value of attribute comparison_sign.



37
38
39
# File 'lib/llt/form.rb', line 37

def comparison_sign
  @comparison_sign
end

#endingObject

Returns the value of attribute ending.



37
38
39
# File 'lib/llt/form.rb', line 37

def ending
  @ending
end

#extensionObject

Returns the value of attribute extension.



37
38
39
# File 'lib/llt/form.rb', line 37

def extension
  @extension
end

#genusObject

Returns the value of attribute genus.



37
38
39
# File 'lib/llt/form.rb', line 37

def genus
  @genus
end

#indexObject

Returns the value of attribute index.



37
38
39
# File 'lib/llt/form.rb', line 37

def index
  @index
end

#inflection_classObject

Returns the value of attribute inflection_class.



37
38
39
# File 'lib/llt/form.rb', line 37

def inflection_class
  @inflection_class
end

#modusObject

Returns the value of attribute modus.



37
38
39
# File 'lib/llt/form.rb', line 37

def modus
  @modus
end

#numerusObject

Returns the value of attribute numerus.



37
38
39
# File 'lib/llt/form.rb', line 37

def numerus
  @numerus
end

#particleObject

Returns the value of attribute particle.



37
38
39
# File 'lib/llt/form.rb', line 37

def particle
  @particle
end

#personaObject

Returns the value of attribute persona.



37
38
39
# File 'lib/llt/form.rb', line 37

def persona
  @persona
end

#placeObject

Returns the value of attribute place.



37
38
39
# File 'lib/llt/form.rb', line 37

def place
  @place
end

#prefixObject

Returns the value of attribute prefix.



37
38
39
# File 'lib/llt/form.rb', line 37

def prefix
  @prefix
end

#sexusObject

Returns the value of attribute sexus.



37
38
39
# File 'lib/llt/form.rb', line 37

def sexus
  @sexus
end

#stemObject

Returns the value of attribute stem.



37
38
39
# File 'lib/llt/form.rb', line 37

def stem
  @stem
end

#stemsObject

Returns the value of attribute stems.



37
38
39
# File 'lib/llt/form.rb', line 37

def stems
  @stems
end

#stringObject

Returns the value of attribute string.



37
38
39
# File 'lib/llt/form.rb', line 37

def string
  @string
end

#suffixObject

Returns the value of attribute suffix.



37
38
39
# File 'lib/llt/form.rb', line 37

def suffix
  @suffix
end

#tempusObject

Returns the value of attribute tempus.



37
38
39
# File 'lib/llt/form.rb', line 37

def tempus
  @tempus
end

Instance Method Details

#functionsObject



56
57
58
# File 'lib/llt/form.rb', line 56

def functions
  @functions ||= Set.new(init_functions)
end

#init_functionsObject

Should be called through super by subclasses



52
53
54
# File 'lib/llt/form.rb', line 52

def init_functions
  [class_name_to_sym]
end

#init_keysObject



47
48
49
# File 'lib/llt/form.rb', line 47

def init_keys
  %i{ inflection_class index classification }
end

#segmentizedObject



60
61
62
# File 'lib/llt/form.rb', line 60

def segmentized
  segments.compact * "-"
end

#to_s(in_segments = false) ⇒ Object Also known as: inspect



64
65
66
67
68
69
70
# File 'lib/llt/form.rb', line 64

def to_s(in_segments = false)
  if in_segments
    segmentized
  else
    @string
  end
end