Sha256: 8c90d341df13f5478c35fad30d4e34cd657da061f3f12f9d23bbbd6566776bcf
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
module W3cRspecValidators class Validator attr_reader :response include W3CValidators def initialize @html_validator = MarkupValidator.new validator_uri: Config.get["w3c_service_uri"] @css_validator = CSSValidator.new validator_uri: Config.get["w3c_css_service_uri"] end def try method, try_count = 1 begin method.call rescue Exception => e raise e if try_count >= 3 sleep 3 try(method, try_count + 1) end end def validate_html text validate = Proc.new { @response = @html_validator.validate_text(text) } try validate raise "Error: Invalid validation response! Tip: check if validator.nu engine is configured correctly" if @response.checked_by.blank? @response end def validate_css text validate = Proc.new { @response = @css_validator.validate_text(text) } try validate raise "Error: Invalid validation response! Tip: check if validator.nu engine is configured correctly" if @response.checked_by.blank? @response end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
w3c_rspec_validators-0.2.1 | lib/w3c_rspec_validators/validator.rb |