class Checker::HTML
Public Class Methods
compile_html_target(inspection)
click to toggle source
# File lib/checker/html.rb, line 7 def self.compile_html_target(inspection) target = inspection.target raise 'Target is required' if target.blank? case inspection.type when 'DeclaresTag' then target.value when 'DeclaresAttribute' then "@#{target.value}" else raise "Unsupported inspection #{inspection.type}" end end
compile_scope(binding)
click to toggle source
# File lib/checker/html.rb, line 18 def self.compile_scope(binding) "//#{binding == '*' ? '' : binding}" end
run(document, expectation, binding)
click to toggle source
# File lib/checker/html.rb, line 3 def self.run(document, expectation, binding) document.xpath "#{compile_scope binding}//#{compile_html_target expectation.inspection}" end