Class: Typhoeus::Response
- Inherits:
-
Object
- Object
- Typhoeus::Response
- Defined in:
- lib/cms_scanner/typhoeus/response.rb
Overview
Custom Response class
Instance Method Summary collapse
-
#html ⇒ Nokogiri::XML
The response’s body parsed by Nokogiri::HTML.
-
#request_size ⇒ Integer
Override of the original to ensure an integer is returned.
- #size ⇒ Integer
-
#xml ⇒ Nokogiri::XML
The response’s body parsed by Nokogiri::XML.
Instance Method Details
#html ⇒ Nokogiri::XML
Returns The response’s body parsed by Nokogiri::HTML.
7 8 9 |
# File 'lib/cms_scanner/typhoeus/response.rb', line 7 def html @html ||= Nokogiri::HTML(body.encode('UTF-8', invalid: :replace, undef: :replace)) end |
#request_size ⇒ Integer
Override of the original to ensure an integer is returned
18 19 20 |
# File 'lib/cms_scanner/typhoeus/response.rb', line 18 def request_size super || 0 end |
#size ⇒ Integer
23 24 25 |
# File 'lib/cms_scanner/typhoeus/response.rb', line 23 def size (body.nil? ? 0 : body.size) + (response_headers.nil? ? 0 : response_headers.size) end |
#xml ⇒ Nokogiri::XML
Returns The response’s body parsed by Nokogiri::XML.
12 13 14 |
# File 'lib/cms_scanner/typhoeus/response.rb', line 12 def xml @xml ||= Nokogiri::XML(body.encode('UTF-8', invalid: :replace, undef: :replace)) end |