Method: Anemone::Page#links

Defined in:
lib/anemone/page.rb

Array of distinct A tag HREFs from the page



57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/anemone/page.rb', line 57

def links
  return @links unless @links.nil?
  @links = []
  return @links if !doc

  doc.search("//a[@href]").each do |a|
    u = a['href']
    next if u.nil? or u.empty?
    abs = to_absolute(u) rescue next
    @links << abs if in_domain?(abs)
  end
  @links.uniq!
  @links
end