Class: Tansaku::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/tansaku/cli.rb

Instance Method Summary collapse

Instance Method Details

#crawl(url) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/tansaku/cli.rb', line 15

def crawl(url)
  params = options.compact.map { |k, v| [k.to_sym, v] }.to_h
  begin
    crawler = Crawler.new(url, **params)
    results = crawler.crawl
    puts results.to_json
  rescue ArgumentError => e
    puts e
  end
end