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.
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
#base ⇒ Object (readonly)
Returns the value of attribute base.
33 34 35 |
# File 'lib/benchmark/http/links_filter.rb', line 33 def base @base end |
#links ⇒ Object (readonly)
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 |