class Object

Public Instance Methods

main() click to toggle source
# File exe/mlb-standings, line 6
def main
  html = Net::HTTP.get(URI('http://espn.go.com/mlb/standings'))
  doc = Nokogiri::HTML(html)

  standings_tables = doc.css("table.standings")

  x = TableMaker.new
  standings_tables.each do |table|
    league_name = table.at_css("caption").text
    x.caption league_name
    table.search("./tr").each do |tr|
      if "th" == tr.first_element_child.node_name
        x.th(tr)
      else
        x.td(tr)
      end
    end
  end
end