Class: ImageInfo::Processor
- Inherits:
-
Object
- Object
- ImageInfo::Processor
- Defined in:
- lib/image_info/processor.rb
Instance Attribute Summary collapse
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(urls, options = { max_concurrency: ::ImageInfo.config.max_concurrency }) ⇒ Processor
constructor
A new instance of Processor.
- #process ⇒ Object
Constructor Details
#initialize(urls, options = { max_concurrency: ::ImageInfo.config.max_concurrency }) ⇒ Processor
Returns a new instance of Processor.
11 12 13 14 |
# File 'lib/image_info/processor.rb', line 11 def initialize(urls, = { max_concurrency: ::ImageInfo.config.max_concurrency }) @images = Array(urls).map { |uri| ::ImageInfo::Image.new(uri) }.keep_if(&:valid?) @options = end |
Instance Attribute Details
#images ⇒ Object (readonly)
Returns the value of attribute images.
9 10 11 |
# File 'lib/image_info/processor.rb', line 9 def images @images end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/image_info/processor.rb', line 9 def @options end |
Instance Method Details
#process ⇒ Object
16 17 18 19 20 21 |
# File 'lib/image_info/processor.rb', line 16 def process images.each { |image| hydra.queue(::ImageInfo::RequestHandler.new(image).build) } hydra.run images end |