Class: ImageInfo::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/image_info/processor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(urls, options = {}) ⇒ Processor

Returns a new instance of Processor.



12
13
14
15
# File 'lib/image_info/processor.rb', line 12

def initialize(urls, options = {})
  @images  = Array(urls).map { |uri| ::ImageInfo::Image.new(uri) }.keep_if(&:valid?)
  @options = options
end

Instance Attribute Details

#imagesObject (readonly)

Returns the value of attribute images.



10
11
12
# File 'lib/image_info/processor.rb', line 10

def images
  @images
end

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/image_info/processor.rb', line 10

def options
  @options
end

Instance Method Details

#processObject



17
18
19
20
21
22
# File 'lib/image_info/processor.rb', line 17

def process
  images.each { |image| hydra.queue(::ImageInfo::RequestHandler.new(image).build) }
  hydra.run

  images
end