Class: Eiwa::Tag::Definition
Instance Attribute Summary collapse
-
#gender ⇒ Object
readonly
Returns the value of attribute gender.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Any
#characters, #parent, #tag_name
Instance Method Summary collapse
- #end_self ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #explanation? ⇒ Boolean
- #figurative? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(text: nil, language: "eng", gender: nil, type: nil) ⇒ Definition
constructor
A new instance of Definition.
- #literal? ⇒ Boolean
Methods inherited from Any
#add_characters, #end_child, #start, #to_s
Constructor Details
#initialize(text: nil, language: "eng", gender: nil, type: nil) ⇒ Definition
Returns a new instance of Definition.
6 7 8 9 10 11 |
# File 'lib/eiwa/tag/definition.rb', line 6 def initialize(text: nil, language: "eng", gender: nil, type: nil) @text = text @language = language @gender = gender @type = type end |
Instance Attribute Details
#gender ⇒ Object (readonly)
Returns the value of attribute gender.
4 5 6 |
# File 'lib/eiwa/tag/definition.rb', line 4 def gender @gender end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
4 5 6 |
# File 'lib/eiwa/tag/definition.rb', line 4 def language @language end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
4 5 6 |
# File 'lib/eiwa/tag/definition.rb', line 4 def text @text end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/eiwa/tag/definition.rb', line 4 def type @type end |
Instance Method Details
#end_self ⇒ Object
13 14 15 16 17 18 |
# File 'lib/eiwa/tag/definition.rb', line 13 def end_self @text = @characters @language = @attrs["xml:lang"] @gender = @attrs["g_gend"] @type = @attrs["g_type"] end |
#eql?(other) ⇒ Boolean Also known as: ==
32 33 34 35 36 37 |
# File 'lib/eiwa/tag/definition.rb', line 32 def eql?(other) @text == other.text && @language == other.language && @gender == other.gender && @type == other.type end |
#explanation? ⇒ Boolean
28 29 30 |
# File 'lib/eiwa/tag/definition.rb', line 28 def explanation? @type == "expl" end |
#figurative? ⇒ Boolean
24 25 26 |
# File 'lib/eiwa/tag/definition.rb', line 24 def figurative? @type == "fig" end |
#hash ⇒ Object
40 41 42 |
# File 'lib/eiwa/tag/definition.rb', line 40 def hash @text.hash + @language.hash + @gender.hash + @type.hash end |
#literal? ⇒ Boolean
20 21 22 |
# File 'lib/eiwa/tag/definition.rb', line 20 def literal? @type == "lit" end |