Class: Benchmark::HTTP::LinksFilter
- Inherits:
-
Trenni::Sanitize::Filter
- Object
- Trenni::Sanitize::Filter
- Benchmark::HTTP::LinksFilter
- Defined in:
- lib/benchmark/http/links_filter.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#links ⇒ Object
readonly
Returns the value of attribute links.
Instance Method Summary collapse
- #filter(node) ⇒ Object
-
#initialize ⇒ LinksFilter
constructor
A new instance of LinksFilter.
Constructor Details
#initialize ⇒ LinksFilter
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
#base ⇒ Object (readonly)
Returns the value of attribute base.
18 19 20 |
# File 'lib/benchmark/http/links_filter.rb', line 18 def base @base end |
#links ⇒ Object (readonly)
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 |