Class: Basilisk::SitemapProcessor

Inherits:
Processor
  • Object
show all
Defined in:
lib/basilisk/processors/sitemap_processor.rb

Overview

Build a google-compatible xml sitemap for the crawled site.

Instance Method Summary collapse

Constructor Details

#initialize(search_name) ⇒ SitemapProcessor

Returns a new instance of SitemapProcessor.



5
6
7
8
9
# File 'lib/basilisk/processors/sitemap_processor.rb', line 5

def initialize(search_name)
  super
  @date = Time.now.strftime("%Y-%m-%d")
  save_header
end

Instance Method Details

#close_fileObject



15
16
17
18
19
# File 'lib/basilisk/processors/sitemap_processor.rb', line 15

def close_file
  write_file do |file|
    file.write "</urlset>\n"
  end
end

#process_page(page, page_hash) ⇒ Object



11
12
13
# File 'lib/basilisk/processors/sitemap_processor.rb', line 11

def process_page(page, page_hash)
  write_url(page)
end