Sha256: e270190ec5d8991ec28b63c48cb60f5992b5a5d4268a3aa92bd7307b4d63159d

Contents?: true

Size: 451 Bytes

Versions: 5

Compression:

Stored size: 451 Bytes

Contents

module IndieWeb
  module Endpoints
    module Services
      class ResponseBodyParserService
        def parse(response, identifier, node = 'link')
          return unless response.mime_type == 'text/html'

          # Reject endpoints that contain a fragment identifier
          Nokogiri::HTML(response.body.to_s).css(%(#{node}[rel~="#{identifier}"][href]:not([href*="#"]))).map { |element| element['href'] }
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
indieweb-endpoints-2.0.0 lib/indieweb/endpoints/services/response_body_parser_service.rb
indieweb-endpoints-1.1.0 lib/indieweb/endpoints/services/response_body_parser_service.rb
indieweb-endpoints-1.0.2 lib/indieweb/endpoints/services/response_body_parser_service.rb
indieweb-endpoints-1.0.1 lib/indieweb/endpoints/services/response_body_parser_service.rb
indieweb-endpoints-1.0.0 lib/indieweb/endpoints/services/response_body_parser_service.rb