Class: Webpage
- Inherits:
-
Object
- Object
- Webpage
- Defined in:
- lib/leander/webpage.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #get_title ⇒ Object
-
#initialize(url) ⇒ Webpage
constructor
A new instance of Webpage.
Constructor Details
#initialize(url) ⇒ Webpage
Returns a new instance of Webpage.
7 8 9 10 |
# File 'lib/leander/webpage.rb', line 7 def initialize url @url = url @doc = Nokogiri::HTML(open(url)) end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
6 7 8 |
# File 'lib/leander/webpage.rb', line 6 def doc @doc end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/leander/webpage.rb', line 6 def url @url end |
Instance Method Details
#get_title ⇒ Object
12 13 14 |
# File 'lib/leander/webpage.rb', line 12 def get_title return @doc.css('title').content end |