Class: SimpleImagesDownloader::Dispenser
- Inherits:
-
Object
- Object
- SimpleImagesDownloader::Dispenser
- Extended by:
- Forwardable
- Includes:
- Validatable
- Defined in:
- lib/simple_images_downloader/dispenser.rb
Overview
Dispenser class Responsible for moving tempfile to destination directory
Instance Method Summary collapse
-
#initialize(source, remote_path, validators = [DestinationValidator.new]) ⇒ Dispenser
constructor
Default: [DestinationValidator.new].
-
#place ⇒ Object
Moves tempfile to destination directory.
Methods included from Validatable
Constructor Details
#initialize(source, remote_path, validators = [DestinationValidator.new]) ⇒ Dispenser
Default: [DestinationValidator.new]
20 21 22 23 24 |
# File 'lib/simple_images_downloader/dispenser.rb', line 20 def initialize(source, remote_path, validators = [DestinationValidator.new]) @source = source @remote_path = remote_path @validators = validators end |
Instance Method Details
#place ⇒ Object
Moves tempfile to destination directory
30 31 32 33 34 |
# File 'lib/simple_images_downloader/dispenser.rb', line 30 def place validate!({ path: destination_dir }) FileUtils.mv @source, target end |