Class: Flickrage::Worker::Compose

Inherits:
Base
  • Object
show all
Defined in:
lib/flickrage/worker/compose.rb

Constant Summary

Constants inherited from Base

Base::MAX_ASK_ERRORS, Base::PRINT_IMAGE_HEADERS, Base::PRINT_IMAGE_HEADERS_LITE

Instance Attribute Summary

Attributes inherited from Base

#opts, #spin

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Helpers::Tty

#spinner

Methods included from Helpers::Log

#logger, #speaker

Constructor Details

This class inherits a constructor from Flickrage::Worker::Base

Instance Method Details

#call(image_list) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/flickrage/worker/compose.rb', line 5

def call(image_list)
  raise Flickrage::CollageError, 'Not enough images for collage' if image_list.resized&.size < 1

  speaker.add_padding
  logger.debug('Collage building process')

  image_list.collage_path = init_file_name

  @spin = spinner(message: 'Collage making')
  result = service.run(image_list)

  if result.composed?
    spin.success
  else
    spin.error('(failed: Collage was not made)')
    raise Flickrage::CollageError
  end

  result
ensure
  spin&.stop
end