Class: Eiwa::Tag::Entity
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Attributes inherited from Any
#characters, #parent, #tag_name
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(code: nil, text: nil) ⇒ Entity
constructor
A new instance of Entity.
- #set_entity(code, text) ⇒ Object
Methods inherited from Any
#add_characters, #end_child, #end_self, #start, #to_s
Constructor Details
#initialize(code: nil, text: nil) ⇒ Entity
Returns a new instance of Entity.
8 9 10 11 |
# File 'lib/eiwa/tag/entity.rb', line 8 def initialize(code: nil, text: nil) @code = code @text = text end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'lib/eiwa/tag/entity.rb', line 6 def code @code end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
6 7 8 |
# File 'lib/eiwa/tag/entity.rb', line 6 def text @text end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
18 19 20 21 |
# File 'lib/eiwa/tag/entity.rb', line 18 def eql?(other) @code == other.code && @text == other.text end |
#hash ⇒ Object
24 25 26 |
# File 'lib/eiwa/tag/entity.rb', line 24 def hash @code.hash + @text.hash end |
#set_entity(code, text) ⇒ Object
13 14 15 16 |
# File 'lib/eiwa/tag/entity.rb', line 13 def set_entity(code, text) @code = code @text = text end |