Class: JsDuck::Img::Writer

Inherits:
Object
  • Object
show all
Defined in:
lib/jsduck/img/writer.rb

Overview

Copies images to destination directory.

Class Method Summary collapse

Class Method Details

.copy(images, output_dir) ⇒ Object

Takes an array of image records retrieved from Img::Dir#all_used or Img::DirSet#all_used and copies all of them to given output directory.



12
13
14
15
16
17
18
19
# File 'lib/jsduck/img/writer.rb', line 12

def self.copy(images, output_dir)
  images.each do |img|
    dest = File.join(output_dir, img[:filename])
    Logger.log("Copying image", dest)
    FileUtils.makedirs(File.dirname(dest))
    FileUtils.cp(img[:full_path], dest)
  end
end