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.



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

def initialize(url, bot=nil)
  @url = url
  @bot = bot
  @@bot_lock = Mutex.new
end

Instance Method Details

#fetchObject



13
14
15
16
17
# File 'lib/macaron/page.rb', line 13

def fetch
  document
  base(@url)
  self
end


19
20
21
22
23
# File 'lib/macaron/page.rb', line 19

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

#titleObject



25
26
27
# File 'lib/macaron/page.rb', line 25

def title
  @doc.title
end