Class: Eiwa::Tag::Antonym
Instance Attribute Summary collapse
-
#sense_ordinal ⇒ Object
readonly
Returns the value of attribute sense_ordinal.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Attributes inherited from Any
#characters, #parent, #tag_name
Instance Method Summary collapse
- #end_self ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(text: nil, sense_ordinal: nil) ⇒ Antonym
constructor
A new instance of Antonym.
Methods inherited from Any
#add_characters, #end_child, #start, #to_s
Constructor Details
#initialize(text: nil, sense_ordinal: nil) ⇒ Antonym
Returns a new instance of Antonym.
6 7 8 9 |
# File 'lib/eiwa/tag/antonym.rb', line 6 def initialize(text: nil, sense_ordinal: nil) @text = text @sense_ordinal = sense_ordinal end |
Instance Attribute Details
#sense_ordinal ⇒ Object (readonly)
Returns the value of attribute sense_ordinal.
4 5 6 |
# File 'lib/eiwa/tag/antonym.rb', line 4 def sense_ordinal @sense_ordinal end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
4 5 6 |
# File 'lib/eiwa/tag/antonym.rb', line 4 def text @text end |
Instance Method Details
#end_self ⇒ Object
11 12 13 14 15 |
# File 'lib/eiwa/tag/antonym.rb', line 11 def end_self parts = @characters.split("・") @text = parts[0] @sense_ordinal = parts[1]&.to_i end |
#eql?(other) ⇒ Boolean Also known as: ==
17 18 19 20 |
# File 'lib/eiwa/tag/antonym.rb', line 17 def eql?(other) @text == other.text && @sense_ordinal == other.sense_ordinal end |
#hash ⇒ Object
23 24 25 |
# File 'lib/eiwa/tag/antonym.rb', line 23 def hash [@text, @sense_ordinal].hash end |