Class: Lingo::Language::WordForm
- Inherits:
-
Object
- Object
- Lingo::Language::WordForm
- Includes:
- Comparable
- Defined in:
- lib/lingo/language/word_form.rb
Overview
– Die Klasse WordForm ist die Basisklasse für weitere Klassen, die im Rahmen der Objektstruktur eines Wortes benötigt werden. Die Klasse stellt eine Zeichenkette bereit, die mit einem Attribut versehen werden kann. ++
Instance Attribute Summary collapse
-
#attr ⇒ Object
Returns the value of attribute attr.
-
#form ⇒ Object
Returns the value of attribute form.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#head ⇒ Object
Returns the value of attribute head.
-
#src ⇒ Object
Returns the value of attribute src.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
- #identified? ⇒ Boolean
-
#initialize(form, attr = WA_UNSET, src = nil) ⇒ WordForm
constructor
A new instance of WordForm.
- #inspect ⇒ Object
- #to_a ⇒ Object
- #to_s ⇒ Object
- #unknown? ⇒ Boolean
- #word_token? ⇒ Boolean
Constructor Details
Instance Attribute Details
#attr ⇒ Object
Returns the value of attribute attr.
46 47 48 |
# File 'lib/lingo/language/word_form.rb', line 46 def attr @attr end |
#form ⇒ Object
Returns the value of attribute form.
46 47 48 |
# File 'lib/lingo/language/word_form.rb', line 46 def form @form end |
#gender ⇒ Object
Returns the value of attribute gender.
46 47 48 |
# File 'lib/lingo/language/word_form.rb', line 46 def gender @gender end |
#head ⇒ Object
Returns the value of attribute head.
46 47 48 |
# File 'lib/lingo/language/word_form.rb', line 46 def head @head end |
#src ⇒ Object
Returns the value of attribute src.
46 47 48 |
# File 'lib/lingo/language/word_form.rb', line 46 def src @src end |
#token ⇒ Object
Returns the value of attribute token.
46 47 48 |
# File 'lib/lingo/language/word_form.rb', line 46 def token @token end |
Instance Method Details
#<=>(other) ⇒ Object
60 61 62 |
# File 'lib/lingo/language/word_form.rb', line 60 def <=>(other) other.nil? ? 1 : to_a <=> other.to_a end |
#eql?(other) ⇒ Boolean Also known as: ==
80 81 82 |
# File 'lib/lingo/language/word_form.rb', line 80 def eql?(other) self.class.equal?(other.class) && (self <=> other) == 0 end |
#hash ⇒ Object
76 77 78 |
# File 'lib/lingo/language/word_form.rb', line 76 def hash to_a.hash end |
#identified? ⇒ Boolean
52 53 54 |
# File 'lib/lingo/language/word_form.rb', line 52 def identified? attr == WA_IDENTIFIED end |
#inspect ⇒ Object
72 73 74 |
# File 'lib/lingo/language/word_form.rb', line 72 def inspect to_s end |
#to_a ⇒ Object
64 65 66 |
# File 'lib/lingo/language/word_form.rb', line 64 def to_a [form, attr, gender] end |
#to_s ⇒ Object
68 69 70 |
# File 'lib/lingo/language/word_form.rb', line 68 def to_s to_a.compact.join('/') end |
#unknown? ⇒ Boolean
48 49 50 |
# File 'lib/lingo/language/word_form.rb', line 48 def unknown? [WA_UNKNOWN, WA_UNKMULPART].include?(attr) end |
#word_token? ⇒ Boolean
56 57 58 |
# File 'lib/lingo/language/word_form.rb', line 56 def word_token? false end |