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.



26
27
28
29
30
31
# File 'lib/benchmark/http/links_filter.rb', line 26

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

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



33
34
35
# File 'lib/benchmark/http/links_filter.rb', line 33

def base
  @base
end

Returns the value of attribute links.



34
35
36
# File 'lib/benchmark/http/links_filter.rb', line 34

def links
  @links
end

Instance Method Details

#filter(node) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/benchmark/http/links_filter.rb', line 36

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