Class: MiniHTML::AST::Tag
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#bad_tag ⇒ Object
(also: #bad_tag?)
Returns the value of attribute bad_tag.
-
#children ⇒ Object
Returns the value of attribute children.
-
#name ⇒ Object
Returns the value of attribute name.
-
#self_closing ⇒ Object
(also: #self_closing?)
Returns the value of attribute self_closing.
Attributes inherited from Base
#original_token, #position_end, #position_start
Instance Method Summary collapse
-
#initialize(token) ⇒ Tag
constructor
A new instance of Tag.
Constructor Details
#initialize(token) ⇒ Tag
Returns a new instance of Tag.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/minihtml/ast/tag.rb', line 10 def initialize(token) super lit = token[:literal] if lit.start_with? "</" @bad_tag = true @name = token[:literal][2...] else @name = token[:literal][1...] end @self_closing = false @attributes = [] @children = [] end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/minihtml/ast/tag.rb', line 6 def attributes @attributes end |
#bad_tag ⇒ Object Also known as: bad_tag?
Returns the value of attribute bad_tag.
6 7 8 |
# File 'lib/minihtml/ast/tag.rb', line 6 def bad_tag @bad_tag end |
#children ⇒ Object
Returns the value of attribute children.
6 7 8 |
# File 'lib/minihtml/ast/tag.rb', line 6 def children @children end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/minihtml/ast/tag.rb', line 6 def name @name end |
#self_closing ⇒ Object Also known as: self_closing?
Returns the value of attribute self_closing.
6 7 8 |
# File 'lib/minihtml/ast/tag.rb', line 6 def self_closing @self_closing end |