Sha256: 9944642ce56853b62b5bad41f35d515ba63e2df4d7804904d284bdbf95ac7491

Contents?: true

Size: 509 Bytes

Versions: 1

Compression:

Stored size: 509 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'
					@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.0 lib/benchmark/http/links_filter.rb