class Fbref::Page

Public Class Methods

from_cache( url ) click to toggle source
# File lib/webget-football/fbref/page.rb, line 5
def self.from_cache( url )
  html = Webcache.read( url )
  new( html )
end
from_file( path ) click to toggle source
# File lib/webget-football/fbref/page.rb, line 10
def self.from_file( path )
  html = File.open( path, 'r:utf-8' ) {|f| f.read }
  new( html )
end
new( html ) click to toggle source
# File lib/webget-football/fbref/page.rb, line 16
def initialize( html )
  @html = html
end

Public Instance Methods

doc() click to toggle source
# File lib/webget-football/fbref/page.rb, line 20
def doc
  ## note: if we use a fragment and NOT a document - no access to page head (and meta elements and such)
  @doc ||= Nokogiri::HTML( @html )
end
title() click to toggle source
# File lib/webget-football/fbref/page.rb, line 25
def title
 # <title>Bundesliga 2010/2011 &raquo; Spielplan</title>
   @title ||= doc.css( 'title' ).first
   @title.text  ## get element's text content
end