class EventSplittr::PhotoCollection

Public Class Methods

new(paths) click to toggle source
# File lib/event_splittr/photo_collection.rb, line 6
def initialize(paths)
  @photos = paths.select {|path| File.extname(path).downcase == ".jpg"}.map {|path| Photo.new(path)}
end

Public Instance Methods

split(destination_dir) click to toggle source
# File lib/event_splittr/photo_collection.rb, line 10
def split(destination_dir)      
  @photos.each do |photo|
    FileUtils.mkdir_p("#{destination_dir}/#{photo.project_name}")
    FileUtils.mv(photo.path, photo.destination_path(destination_dir))
    puts "Moved: #{photo.path} to #{photo.destination_path(destination_dir)}"
  end
  puts "-> Moved #{@photos.size} photos."
end
split_dry_run(destination_dir) click to toggle source
# File lib/event_splittr/photo_collection.rb, line 19
def split_dry_run(destination_dir)
  @photos.each do |photo|
    puts "Will move: #{photo.path} to #{photo.destination_path(destination_dir)}"
  end
end