class Spider
Attributes
base_path[R]
data[R]
ignored_links[R]
Public Class Methods
new(base_path)
click to toggle source
# File lib/contentar/spider.rb, line 3 def initialize(base_path) @base_path = base_path @ignored_links = [/.js/, /.css/] @data = [] end
Public Instance Methods
get_data()
click to toggle source
# File lib/contentar/spider.rb, line 9 def get_data get_site_data data end
Private Instance Methods
get_page_data(page)
click to toggle source
# File lib/contentar/spider.rb, line 28 def get_page_data(page) { url: page.url.to_s, title: page.title } end
get_pages_data(site)
click to toggle source
# File lib/contentar/spider.rb, line 22 def get_pages_data(site) site.every_page do |page| data << get_page_data(page) end end
get_site_data()
click to toggle source
# File lib/contentar/spider.rb, line 16 def get_site_data Spidr.site(base_path, ignore_links: ignored_links) do |site| get_pages_data(site) end end