Method: Botz::Shell#spider

Defined in:
lib/botz/shell.rb

#spider(name) ⇒ Object

rubocop:enable Lint/AssignmentInCondition, Style/RescueStandardError



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/botz/shell.rb', line 28

def spider(name)
  command = spiders[name.to_sym]
  if File.pipe?(STDIN)
    STDIN.each_line do |line|
      start_url = line.strip
      command.call(start_url) { |url| puts url }
    end
  else
    command.call { |url| puts url }
  end
end