Class: Nous::Crawler::LinkExtractor
- Inherits:
-
Object
- Object
- Nous::Crawler::LinkExtractor
- Defined in:
- lib/nous/crawler/link_extractor.rb
Instance Method Summary collapse
- #extract(current_url, html) ⇒ Object
-
#initialize(url_filter:) ⇒ LinkExtractor
constructor
A new instance of LinkExtractor.
Constructor Details
#initialize(url_filter:) ⇒ LinkExtractor
Returns a new instance of LinkExtractor.
8 9 10 |
# File 'lib/nous/crawler/link_extractor.rb', line 8 def initialize(url_filter:) @url_filter = url_filter end |
Instance Method Details
#extract(current_url, html) ⇒ Object
12 13 14 |
# File 'lib/nous/crawler/link_extractor.rb', line 12 def extract(current_url, html) anchors(html).filter_map { |href| resolve(current_url, href) }.uniq end |