Sha256: 1580a238cf10076a716ec90aef67b2f4727f99a9f76e717378a42e04cc0dc393

Contents?: true

Size: 695 Bytes

Versions: 2

Compression:

Stored size: 695 Bytes

Contents

class WikiOnThisDay::CLI

  attr_reader :todays_page

  def initialize
    @todays_page = WikiOnThisDay::Scraper::Homepage.new
    print_controller = WikiOnThisDay::Printer.new(self.todays_page.html_doc, self.todays_page.on_this_day)
    print_controller.print
    print "To learn more about one of these events, enter the year as displayed above. To exit, enter anything else: "
    input = gets.strip
    more_information(input)
  end

  def more_information(year)
    self.todays_page.on_this_day.each do |key, value|
      if value[:year] == year
        puts ''
        puts WikiOnThisDay::Scraper::Article.new(value[:link_url]).article_abstract
        puts ''
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wiki_on_this_day-0.1.1 lib/wiki_on_this_day/cli.rb
wiki_on_this_day-0.1.0 lib/wiki_on_this_day/cli.rb