Class: Webpage

Inherits:
Object
  • Object
show all
Defined in:
lib/leander/webpage.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#docObject (readonly)

Returns the value of attribute doc.



6
7
8
# File 'lib/leander/webpage.rb', line 6

def doc
  @doc
end

#urlObject (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_titleObject



12
13
14
# File 'lib/leander/webpage.rb', line 12

def get_title
	return @doc.css('title').content
end