class BetterHtml::Tree::AttributesList

Public Class Methods

from_nodes(nodes) click to toggle source
# File lib/better_html/tree/attributes_list.rb, line 10
def self.from_nodes(nodes)
  new(nodes&.map { |node| Tree::Attribute.from_node(node) })
end
new(list) click to toggle source
# File lib/better_html/tree/attributes_list.rb, line 6
def initialize(list)
  @list = list || []
end

Public Instance Methods

[](name) click to toggle source
# File lib/better_html/tree/attributes_list.rb, line 14
def [](name)
  @list.find do |attribute|
    attribute.name == name.downcase
  end
end
each(&block) click to toggle source
# File lib/better_html/tree/attributes_list.rb, line 20
def each(&block)
  @list.each(&block)
end