Class: ScriptRipper::Downloader
- Inherits:
-
Object
- Object
- ScriptRipper::Downloader
- Defined in:
- lib/script_ripper/downloader.rb
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(url) ⇒ Downloader
constructor
A new instance of Downloader.
Constructor Details
#initialize(url) ⇒ Downloader
Returns a new instance of Downloader.
7 8 9 |
# File 'lib/script_ripper/downloader.rb', line 7 def initialize(url) @url = url end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/script_ripper/downloader.rb', line 5 def url @url end |
Class Method Details
.call(url) ⇒ Object
20 21 22 |
# File 'lib/script_ripper/downloader.rb', line 20 def call(url) new(url).call end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/script_ripper/downloader.rb', line 11 def call StringIO.new.tap { |content| URI.open(url) do |remote_content| content.write(remote_content.read) end }.string end |