class Twexicon::CLI

Public Instance Methods

call() click to toggle source
# File lib/twexicon/cli.rb, line 2
def call
  puts "Welcome to Twexicon."
  run = true

  while run
    username = Twexicon::Validator.new.run
    tweets = Twexicon::Scraper.new(username).refine_tweets
    if tweets.empty?
      puts "Unfortunately, @#{username} has never tweeted or has their tweets protected. Sorry about that."
    else
      Twexicon::Analyzer.new(username, tweets)
    end

    input = ""
    until input =~ /^[yn]$/
      puts "Would you like to look up tweets from another Twitter handle? [Y/N]"
      input = gets.strip.gsub(/\W/, "").downcase
    end
    input =~ /[n]/ ? run = false : run = true
  end

  puts "Thank you –– come again!"
end