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.
6 7 8 9 |
# File 'lib/eiwa/tag/entity.rb', line 6 def initialize(code: nil, text: nil) @code = code @text = text end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/eiwa/tag/entity.rb', line 4 def code @code end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
4 5 6 |
# File 'lib/eiwa/tag/entity.rb', line 4 def text @text end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
16 17 18 19 |
# File 'lib/eiwa/tag/entity.rb', line 16 def eql?(other) @code == other.code && @text == other.text end |
#hash ⇒ Object
22 23 24 |
# File 'lib/eiwa/tag/entity.rb', line 22 def hash @code.hash + @text.hash end |
#set_entity(code, text) ⇒ Object
11 12 13 14 |
# File 'lib/eiwa/tag/entity.rb', line 11 def set_entity(code, text) @code = code @text = text end |