class NyBaseballHeadlines::News

Attributes

headlines[RW]

Public Class Methods

mets_post() click to toggle source
# File lib/ny_baseball_headlines/news.rb, line 10
def self.mets_post 
  mets = self.new
  mets_doc = Nokogiri::HTML(open("http://nypost.com/tag/new-york-mets/"))
  mets_doc.search("article header h3 a[href]").each_with_object({}) do |m|
  mets.headlines << m.text
  end
  mets
end
new() click to toggle source
# File lib/ny_baseball_headlines/news.rb, line 6
def initialize
  @headlines = []
end
yanks_post() click to toggle source
# File lib/ny_baseball_headlines/news.rb, line 19
def self.yanks_post 
  yanks = self.new
  yanks_doc = Nokogiri::HTML(open("http://nypost.com/tag/new-york-yankees/"))
  yanks_doc.search("article header h3 a[href]").each_with_object({}) do |y|
    yanks.headlines << y.text
  end
  yanks
end