class NewsFetcher
Public Class Methods
fetch(url, structure, color)
click to toggle source
# File lib/news_fetcher.rb, line 9 def self.fetch url, structure, color color ||= "black" doc = Nokogiri::HTML(open(url)) nodes = doc.css(structure) nodes.each do |n| puts n.text.strip.send(color) puts end return doc, nodes end
hi()
click to toggle source
# File lib/news_fetcher.rb, line 5 def self.hi puts "Hi, I'm NewsFetcher!" end