Class: Nigel::Commands::Flood

Inherits:
Object
  • Object
show all
Defined in:
lib/nigel/commands/flood.rb

Class Method Summary collapse

Class Method Details

.process(options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/nigel/commands/flood.rb', line 4

def self.process(options)

  Google::Search::Image.new(
    query: 'Nigel Thornberry').each_with_index do |image, i|

    threads = []

    if(image.uri.include? '.gif')

      puts "Nigel spotted at #{ image.uri }!"
      
      threads << self.fetch(image.uri, "#{ i }.gif")
    end

    threads.each(&:join)
  end
end