Method: Botz::Shell#scraper

Defined in:
lib/botz/shell.rb

#scraper(name) ⇒ Object

rubocop:disable Lint/AssignmentInCondition, Style/RescueStandardError



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/botz/shell.rb', line 15

def scraper(name)
  command = scrapers[name.to_sym]
  while line = STDIN.gets
    url = line.strip
    begin
      command.call(url, &definition_file.output)
    rescue => e
      STDERR.puts "ERROR #{e}"
    end
  end
end