Class: Benchmark::HTTP::LinksFilter

Inherits:
Trenni::Sanitize::Filter
  • Object
show all
Defined in:
lib/benchmark/http/links_filter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLinksFilter

Returns a new instance of LinksFilter.



11
12
13
14
15
16
# File 'lib/benchmark/http/links_filter.rb', line 11

def initialize(*)
	super
	
	@base = nil
	@links = []
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



18
19
20
# File 'lib/benchmark/http/links_filter.rb', line 18

def base
  @base
end

Returns the value of attribute links.



19
20
21
# File 'lib/benchmark/http/links_filter.rb', line 19

def links
  @links
end

Instance Method Details

#filter(node) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/benchmark/http/links_filter.rb', line 21

def filter(node)
	if node.name == 'base'
		@base = node['href']
	elsif node.name == 'a'
		@links << node['href']
	end
	
	node.skip!(TAG)
end