Class: Kotoshu::Readers::Affix
- Inherits:
-
Object
- Object
- Kotoshu::Readers::Affix
- Defined in:
- lib/kotoshu/readers/aff_data.rb
Overview
Affix data class for Hunspell affix rules.
This class represents a prefix or suffix affix rule.
Instance Attribute Summary collapse
-
#add ⇒ String
Characters to add to the word.
-
#condition ⇒ String
Condition for applying this rule.
-
#crossproduct ⇒ Boolean
Whether this is a cross-product rule.
-
#flag ⇒ String
The flag character identifying this rule.
-
#flags ⇒ Set<String>
Additional flags.
-
#strip ⇒ String
Characters to strip from the word.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, flag:, crossproduct:, strip:, add:, condition:, flags: Set.new) ⇒ Affix
constructor
Create a new affix.
-
#inspect ⇒ String
Inspect string.
-
#prefix? ⇒ Boolean
Check if this is a prefix.
-
#suffix? ⇒ Boolean
Check if this is a suffix.
-
#to_s ⇒ String
String representation.
Constructor Details
#initialize(type:, flag:, crossproduct:, strip:, add:, condition:, flags: Set.new) ⇒ Affix
Create a new affix.
38 39 40 41 42 43 44 45 46 |
# File 'lib/kotoshu/readers/aff_data.rb', line 38 def initialize(type:, flag:, crossproduct:, strip:, add:, condition:, flags: Set.new) @type = type @flag = flag @crossproduct = crossproduct @strip = strip @add = add @condition = condition @flags = flags end |
Instance Attribute Details
#add ⇒ String
Characters to add to the word
26 27 28 |
# File 'lib/kotoshu/readers/aff_data.rb', line 26 def add @add end |
#condition ⇒ String
Condition for applying this rule
26 27 28 |
# File 'lib/kotoshu/readers/aff_data.rb', line 26 def condition @condition end |
#crossproduct ⇒ Boolean
Whether this is a cross-product rule
26 27 28 |
# File 'lib/kotoshu/readers/aff_data.rb', line 26 def crossproduct @crossproduct end |
#flag ⇒ String
The flag character identifying this rule
26 27 28 |
# File 'lib/kotoshu/readers/aff_data.rb', line 26 def flag @flag end |
#flags ⇒ Set<String>
Additional flags
26 27 28 |
# File 'lib/kotoshu/readers/aff_data.rb', line 26 def flags @flags end |
#strip ⇒ String
Characters to strip from the word
26 27 28 |
# File 'lib/kotoshu/readers/aff_data.rb', line 26 def strip @strip end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
27 28 29 |
# File 'lib/kotoshu/readers/aff_data.rb', line 27 def type @type end |
Instance Method Details
#inspect ⇒ String
Inspect string.
73 74 75 |
# File 'lib/kotoshu/readers/aff_data.rb', line 73 def inspect to_s end |
#prefix? ⇒ Boolean
Check if this is a prefix.
51 52 53 |
# File 'lib/kotoshu/readers/aff_data.rb', line 51 def prefix? @type == :prefix end |
#suffix? ⇒ Boolean
Check if this is a suffix.
58 59 60 |
# File 'lib/kotoshu/readers/aff_data.rb', line 58 def suffix? @type == :suffix end |
#to_s ⇒ String
String representation.
65 66 67 68 |
# File 'lib/kotoshu/readers/aff_data.rb', line 65 def to_s type_str = prefix? ? 'Prefix' : 'Suffix' "#{type_str}(#{@add}: #{@flag}#{@crossproduct ? '×' : ''}/#{@flags.to_a.join(',')}, on #{condition})" end |