Class: Wovnrb::MultiTagMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/wovnrb/html_replacers/link_replacer.rb

Instance Method Summary collapse

Instance Method Details

#a_tag?(node) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/wovnrb/html_replacers/link_replacer.rb', line 43

def a_tag?(node)
  node.name == 'a'
end

Returns:

  • (Boolean)


47
48
49
# File 'lib/wovnrb/html_replacers/link_replacer.rb', line 47

def link_tag_with_canonical?(node)
  node.name == 'link' && node.get_attribute('rel') == 'canonical'
end

#match(node_set) ⇒ Object



39
40
41
# File 'lib/wovnrb/html_replacers/link_replacer.rb', line 39

def match(node_set)
  node_set.find_all { |node| a_tag?(node) || link_tag_with_canonical?(node) }
end