Class: NewsFetcher
Class Method Summary collapse
Class Method Details
.fetch(url, structure, color) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# 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 ⇒ Object
5 6 7 |
# File 'lib/news_fetcher.rb', line 5 def self.hi puts "Hi, I'm NewsFetcher!" end |