Class: Macaron::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/macaron/page.rb

Instance Method Summary collapse

Constructor Details

#initialize(url, bot = nil) ⇒ Page

Returns a new instance of Page.



6
7
8
9
# File 'lib/macaron/page.rb', line 6

def initialize(url, bot=nil)
  @url = url
  @bot = bot
end

Instance Method Details

#fetchObject



11
12
13
14
15
# File 'lib/macaron/page.rb', line 11

def fetch
  document
  base(@url)
  self
end


17
18
19
20
21
# File 'lib/macaron/page.rb', line 17

def inner_links
  anchors = links.select {|link| 
    URI.parse(link).host == @base.host 
  }.compact
end

#titleObject



23
24
25
# File 'lib/macaron/page.rb', line 23

def title
  @doc.title
end