Class: PageDownloader::Filters::EmbedScript
- Inherits:
-
Object
- Object
- PageDownloader::Filters::EmbedScript
- Defined in:
- lib/page_downloader/filters/embed_script.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#fetcher ⇒ Object
readonly
Returns the value of attribute fetcher.
Instance Method Summary collapse
- #filter(content) ⇒ Object
-
#initialize(options = {}) ⇒ EmbedScript
constructor
A new instance of EmbedScript.
Constructor Details
#initialize(options = {}) ⇒ EmbedScript
6 7 8 9 |
# File 'lib/page_downloader/filters/embed_script.rb', line 6 def initialize( = {}) @fetcher = .fetch :fetcher @url_resolver = .fetch :url_resolver end |
Instance Attribute Details
#fetcher ⇒ Object (readonly)
Returns the value of attribute fetcher.
4 5 6 |
# File 'lib/page_downloader/filters/embed_script.rb', line 4 def fetcher @fetcher end |
Instance Method Details
#filter(content) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/page_downloader/filters/embed_script.rb', line 11 def filter(content) content.css("script").select do |script| script.attributes["src"] end.each do |script| (script) end content end |