Class: HtmlFromPdf::Downloader
- Inherits:
-
Object
- Object
- HtmlFromPdf::Downloader
show all
- Extended by:
- Helpers
- Defined in:
- lib/html_from_pdf/downloader.rb
Class Method Summary
collapse
Methods included from Helpers
create_dir, default_file_path
Class Method Details
.download(url) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/html_from_pdf/downloader.rb', line 5
def self.download(url)
return unless valid_url? url
file_path = default_file_path(:pdf)
dir_path = File.split(file_path).first
create_dir dir_path
File.open(file_path, 'wb') do |file|
file.write open(url).read
end
file_path
end
|