module Mato::Concerns::HtmlNodeCheckable

Public Instance Methods

has_ancestor?(node, *tags) click to toggle source

@param [Nokogiri::XML::Node] node @param [Array<String>] tags - set of tags @return [Boolean] true if the node has the specified tags as a parent

# File lib/mato/concerns/html_node_checkable.rb, line 11
def has_ancestor?(node, *tags)
  current = node
  while (current = current.parent)
    if tags.include?(current.name)
      return true
    end
  end
  false
end