Class: Kotoshu::Readers::ConditionChecker Abstract
- Inherits:
-
Object
- Object
- Kotoshu::Readers::ConditionChecker
- Defined in:
- lib/kotoshu/readers/condition_checker.rb
Overview
This class is abstract.
Subclasses must implement the matches? method
Base class for checking affix conditions.
Hunspell affix rules specify conditions that the stem must match before an affix can be applied. Different scripts may have different interpretations of these conditions.
Direct Known Subclasses
Class Method Summary collapse
-
.compile(condition, script: :latin) ⇒ ConditionChecker
Compile a condition string into a checker.
Instance Method Summary collapse
-
#matches?(stem) ⇒ Boolean
Check if the given stem matches this condition.
Class Method Details
.compile(condition, script: :latin) ⇒ ConditionChecker
Compile a condition string into a checker.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/kotoshu/readers/condition_checker.rb', line 23 def self.compile(condition, script: :latin) case script when :latin LatinScriptConditionChecker.compile(condition) else # For other scripts, create a passthrough checker # (condition is not applied) PassthroughConditionChecker.new end end |
Instance Method Details
#matches?(stem) ⇒ Boolean
Check if the given stem matches this condition.
38 39 40 |
# File 'lib/kotoshu/readers/condition_checker.rb', line 38 def matches?(stem) raise NotImplementedError, "#{self.class} must implement #matches?" end |