Module: Photomontage

Defined in:
lib/photomontage.rb,
lib/photomontage/version.rb

Constant Summary collapse

VERSION =
"0.0.7"

Class Method Summary collapse

Class Method Details

.beginObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/photomontage.rb', line 12

def self.begin
  puts Interaction::WELCOME
  keywords = []
  10.times{
    word = STDIN.gets.chomp
    break if word == 'exit'
    keywords << word if !word.empty?
  }
  keywords
end

.respond(keywords) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/photomontage.rb', line 23

def self.respond(keywords)
  Dir.mkdir 'tmp' unless File.exists?('tmp')
  FileUtils.rm_rf(Dir.glob('tmp/*'))
  puts Interaction::IN_PROGRESS

  keywords.each_with_index do |keyword, index|
    scrape_flickr(keyword, index)
  end
  verify_images_present?
  puts Interaction::FILE_NAME
  file_name = STDIN.gets.chomp
  Flickr.create_collage(file_name)
  FileUtils.rm_rf(Dir.glob('tmp/*'))
  puts Interaction::COMPLETE.gsub('FILE_NAME', file_name)
end