class BetterHtml::Tree::Tag

Attributes

attributes_node[R]
end_solidus[R]
name_node[R]
node[R]
start_solidus[R]

Public Class Methods

from_node(node) click to toggle source
# File lib/better_html/tree/tag.rb, line 14
def self.from_node(node)
  new(node)
end
new(node) click to toggle source
# File lib/better_html/tree/tag.rb, line 9
def initialize(node)
  @node = node
  @start_solidus, @name_node, @attributes_node, @end_solidus = *node
end

Public Instance Methods

attributes() click to toggle source
# File lib/better_html/tree/tag.rb, line 34
def attributes
  @attributes ||= AttributesList.from_nodes(@attributes_node.to_a)
end
closing?() click to toggle source
# File lib/better_html/tree/tag.rb, line 26
def closing?
  @start_solidus&.type == :solidus
end
loc() click to toggle source
# File lib/better_html/tree/tag.rb, line 18
def loc
  @node.loc
end
name() click to toggle source
# File lib/better_html/tree/tag.rb, line 22
def name
  @name_node&.loc&.source&.downcase
end
self_closing?() click to toggle source
# File lib/better_html/tree/tag.rb, line 30
def self_closing?
  @end_solidus&.type == :solidus
end