Class: IndieWeb::Endpoints::ResponseBodyParser Private
- Inherits:
-
Object
- Object
- IndieWeb::Endpoints::ResponseBodyParser
- Defined in:
- lib/indieweb/endpoints/response_body_parser.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#initialize(response) ⇒ ResponseBodyParser
constructor
private
A new instance of ResponseBodyParser.
- #results_for(identifier, nodes = ["link"]) ⇒ Array<string>? private
Constructor Details
#initialize(response) ⇒ ResponseBodyParser
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ResponseBodyParser.
8 9 10 11 12 |
# File 'lib/indieweb/endpoints/response_body_parser.rb', line 8 def initialize(response) @body = response.body.to_s @mime_type = response.mime_type @uri = response.uri end |
Instance Method Details
#results_for(identifier, nodes = ["link"]) ⇒ Array<string>?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 20 21 22 23 24 |
# File 'lib/indieweb/endpoints/response_body_parser.rb', line 17 def results_for(identifier, nodes = ["link"]) return unless mime_type == "text/html" # Reject endpoints that contain a fragment identifier selectors = nodes.map { |node| %(#{node}[rel~="#{identifier}"][href]:not([href*="#"])) }.join(",") parsed_body.css(selectors).map { |element| element["href"] } end |