Sha256: 51b44a18492f92d2adf55e3b9e27186f7888627ac132eed04dc9bbfdba64ab29

Contents?: true

Size: 556 Bytes

Versions: 1

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2018-2022, by Samuel Williams.

require 'trenni/sanitize'

module Benchmark
	module HTTP
		class LinksFilter < Trenni::Sanitize::Filter
			def initialize(*)
				super
				
				@base = nil
				@links = []
			end
			
			attr :base
			attr :links
			
			def filter(node)
				if node.name == 'base'
					@base = node['href']
				elsif node.name == 'a' and node['href'] and node['rel'] != 'nofollow'
					@links << node['href']
				end
				
				node.skip!(TAG)
			end
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
benchmark-http-0.16.1 lib/benchmark/http/links_filter.rb