Class: Imgfetcha::BatchFetcher
- Inherits:
-
Object
- Object
- Imgfetcha::BatchFetcher
- Defined in:
- lib/imgfetcha/batch_fetcher.rb
Constant Summary collapse
- VALID_TYPES =
NOTE: ‘bin’ stands for ‘application/octet-stream`
%w[jpeg jpg png gif heic bin].freeze
Instance Attribute Summary collapse
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#urls ⇒ Object
readonly
Returns the value of attribute urls.
Instance Method Summary collapse
-
#initialize(urls, options) ⇒ BatchFetcher
constructor
A new instance of BatchFetcher.
- #run ⇒ Object
Constructor Details
#initialize(urls, options) ⇒ BatchFetcher
Returns a new instance of BatchFetcher.
11 12 13 14 15 |
# File 'lib/imgfetcha/batch_fetcher.rb', line 11 def initialize(urls, ) @urls = urls @output_dir = [:output_dir] || Dir.pwd @verbose = [:verbose] end |
Instance Attribute Details
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
9 10 11 |
# File 'lib/imgfetcha/batch_fetcher.rb', line 9 def output_dir @output_dir end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
9 10 11 |
# File 'lib/imgfetcha/batch_fetcher.rb', line 9 def result @result end |
#urls ⇒ Object (readonly)
Returns the value of attribute urls.
9 10 11 |
# File 'lib/imgfetcha/batch_fetcher.rb', line 9 def urls @urls end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 |
# File 'lib/imgfetcha/batch_fetcher.rb', line 17 def run @result = batch_download puts "\nDownloaded #{@result.count} images" @result end |