class Webmention::Verification::Verifiers::HtmlVerifier
Constants
- HTML_ATTRIBUTE_MAP
Private Instance Methods
doc()
click to toggle source
# File lib/webmention/verification/verifiers/html_verifier.rb, line 20 def doc @doc ||= Nokogiri::HTML(response_body) end
parse_response_body()
click to toggle source
# File lib/webmention/verification/verifiers/html_verifier.rb, line 24 def parse_response_body HTML_ATTRIBUTE_MAP.each_with_object([]) { |(*args), matches| matches << search_doc(*args) }.flatten end
search_doc(attribute, elements)
click to toggle source
# File lib/webmention/verification/verifiers/html_verifier.rb, line 28 def search_doc(attribute, elements) regexp = attribute == :srcset ? srcset_attribute_regexp : target_regexp doc.css(*elements.map { |element| "#{element}[#{attribute}]" }).find_all do |node| node[attribute].match?(regexp) end end
srcset_attribute_regexp()
click to toggle source
# File lib/webmention/verification/verifiers/html_verifier.rb, line 36 def srcset_attribute_regexp @srcset_attribute_regexp ||= /(?:^|\b)#{target_regexp_str}\s/ end