Class: ImageCollage::Runner
- Inherits:
-
Object
- Object
- ImageCollage::Runner
- Defined in:
- lib/imagecollage/runner.rb
Constant Summary collapse
- COLLAGE_IMAGE_COUNT =
10
Instance Attribute Summary collapse
-
#keywords ⇒ Object
readonly
Returns the value of attribute keywords.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(keywords, options) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(keywords, options) ⇒ Runner
Returns a new instance of Runner.
8 9 10 11 |
# File 'lib/imagecollage/runner.rb', line 8 def initialize(keywords, ) @keywords = keywords @options = || {} end |
Instance Attribute Details
#keywords ⇒ Object (readonly)
Returns the value of attribute keywords.
4 5 6 |
# File 'lib/imagecollage/runner.rb', line 4 def keywords @keywords end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/imagecollage/runner.rb', line 4 def @options end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/imagecollage/runner.rb', line 13 def run flickr_api = ImageCollage::FlickrApi.new(@options.fetch(:flickr_api_key)) image_url_requester = ImageUrlRequester.new(@keywords, flickr_api, image_url_count: COLLAGE_IMAGE_COUNT) collage_generator = CollageGenerator.new(image_url_requester.image_urls) collage_generator.generate_image_collage(@options.fetch(:image_collage_path)) return 0 end |