class KdnuggetsRoundup::RoundupCLI
Public Instance Methods
breakline_space_only()
click to toggle source
formatting methods
# File lib/kdnuggets_roundup.rb, line 9 def breakline_space_only puts "" end
breakline_title()
click to toggle source
# File lib/kdnuggets_roundup.rb, line 13 def breakline_title puts ". . ." breakline_space_only end
call()
click to toggle source
# File lib/kdnuggets_roundup.rb, line 60 def call breakline_space_only puts "Howdy, stranger!" breakline_title puts "The Kdnuggets Roundup is your source for the top articles in data science, as curated by KDnuggets.com." puts "Let's see what we can wrassle up..." KdnuggetsRoundup::DataWrassler.new.wrassle_top_stories main_menu end
display_article(article)
click to toggle source
# File lib/kdnuggets_roundup.rb, line 33 def display_article(article) puts <<-DOC #{article.title} By: #{article.author} Tags: #{article.tags.dup.join(', ')} Summary ------- #{article.summary} DOC end
display_rankings()
click to toggle source
# File lib/kdnuggets_roundup.rb, line 45 def display_rankings puts "Most Popular" list(KdnuggetsRoundup::Article.popular) puts "" puts "Most Shared" list(KdnuggetsRoundup::Article.shared) puts "" end
gun_graphic()
click to toggle source
# File lib/kdnuggets_roundup.rb, line 18 def gun_graphic puts ' \\\__________' puts " | ______-/ ---------------------------------------- =>" puts " / { }" puts "/__/" end
list(collection)
click to toggle source
article / collection display methods
# File lib/kdnuggets_roundup.rb, line 27 def list(collection) collection.each_with_index do |article, i| puts "#{i + 1}. #{article.title}" end end
read_excerpt(article)
click to toggle source
# File lib/kdnuggets_roundup.rb, line 54 def read_excerpt(article) article.excerpt.each do |paragraph| puts paragraph end end