class Crabbs::Page
Public Class Methods
new(html, url)
click to toggle source
# File lib/crabbs/page.rb, line 6 def initialize(html, url) @html = Nokogiri::HTML(html) @url = url end
Public Instance Methods
links()
click to toggle source
# File lib/crabbs/page.rb, line 11 def links links = @html.css('a[href]').map { |a| Crabbs::Link.new a['href'] } links .select { |link| link.same_host_as? @url } .select(&:has_valid_fragment?) .select(&:has_html_extension?) .map { |link| link.join @url } .uniq end