Class: Linguistics::Latin::Verb::LatinVerb::Classifier

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/latinverb_classifier.rb,
lib/latinverb_classifier/classifier.rb,
lib/latinverb_classifier/strategies/verb_classification_strategy.rb,
lib/latinverb_classifier/strategies/regular_verb_classification_strategy.rb,
lib/latinverb_classifier/strategies/deponent_verb_classification_strategy.rb,
lib/latinverb_classifier/strategies/defective_verb_classification_strategy.rb,
lib/latinverb_classifier/strategies/irregular_verb_classification_strategy.rb,
lib/latinverb_classifier/strategies/impersonal_verb_classification_strategy.rb,
lib/latinverb_classifier/strategies/present_only_verb_classification_strategy.rb,
lib/latinverb_classifier/strategies/semideponent_verb_classification_strategy.rb,
lib/latinverb_classifier/strategies/very_irregular_verb_classification_strategy.rb

Defined Under Namespace

Classes: DefectiveVerbClassificationStrategy, DeponentVerbClassificationStrategy, ImpersonalVerbClassificationStrategy, IrregularVerbClassificationStrategy, PresentonlyVerbClassificationStrategy, RegularVerbClassificationStrategy, SemideponentVerbClassificationStrategy, VerbClassificationStrategy, VeryIrregularVerbClassificationStrategy

Instance Method Summary collapse

Constructor Details

#initialize(verb, opts = {}) ⇒ Classifier

Returns a new instance of Classifier.



7
8
9
# File 'lib/latinverb_classifier/classifier.rb', line 7

def initialize(verb, opts={})
  @verb, @opts = verb, opts
end

Instance Method Details

#classificationObject



11
12
13
# File 'lib/latinverb_classifier/classifier.rb', line 11

def classification
  @c ||= strategies.detect { |s| s.new(self).applicable? }.classification
end

#deponent?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/latinverb_classifier/classifier.rb', line 28

def deponent?
  classification == Linguistics::Latin::Verb::Classification::Deponent
end

#impersonal?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/latinverb_classifier/classifier.rb', line 36

def impersonal?
  classification == Linguistics::Latin::Verb::Classification::Impersonal
end

#inputObject



15
16
17
# File 'lib/latinverb_classifier/classifier.rb', line 15

def input
  @input ||= @verb.original_string
end

#irregular?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/latinverb_classifier/classifier.rb', line 40

def irregular?
  classification == Linguistics::Latin::Verb::Classification::Irregular
end

#present_only?Boolean

Returns:

  • (Boolean)


23
24
25
26
# File 'lib/latinverb_classifier/classifier.rb', line 23

def present_only?
  classification == Linguistics::Latin::Verb::Classification::PresentOnly ||
    extremely_irregular?
end

#proxy_verb?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/latinverb_classifier/classifier.rb', line 19

def proxy_verb?
  !!@verb.options[:proxy_verb]
end

#regular?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/latinverb_classifier/classifier.rb', line 44

def regular?
  classification == Linguistics::Latin::Verb::Classification::Regular
end

#semideponent?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/latinverb_classifier/classifier.rb', line 32

def semideponent?
  classification == Linguistics::Latin::Verb::Classification::Semideponent
end

#short_classObject



48
49
50
# File 'lib/latinverb_classifier/classifier.rb', line 48

def short_class
  classification.to_s.split('::').last
end