Class: Headhunter::HtmlValidator::Response
- Inherits:
-
Object
- Object
- Headhunter::HtmlValidator::Response
- Defined in:
- lib/headhunter/html_validator.rb
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(response = nil, uri = nil) ⇒ Response
constructor
A new instance of Response.
- #valid? ⇒ Boolean
Constructor Details
#initialize(response = nil, uri = nil) ⇒ Response
Returns a new instance of Response.
67 68 69 70 |
# File 'lib/headhunter/html_validator.rb', line 67 def initialize(response = nil, uri = nil) @response = response @uri = uri end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
65 66 67 |
# File 'lib/headhunter/html_validator.rb', line 65 def uri @uri end |
Instance Method Details
#errors ⇒ Object
76 77 78 79 80 81 82 83 84 |
# File 'lib/headhunter/html_validator.rb', line 76 def errors @response.split("\n").map do |error| matches = error.match(/line (\d*) column (\d*) - (.*)/) Error.new( matches[1], matches[3], column: matches[2] ) end end |
#valid? ⇒ Boolean
72 73 74 |
# File 'lib/headhunter/html_validator.rb', line 72 def valid? @response.empty? end |