Class: Basilisk::SitemapProcessor
- Defined in:
- lib/basilisk/processors/sitemap_processor.rb
Overview
Build a google-compatible xml sitemap for the crawled site.
Instance Method Summary collapse
- #close_file ⇒ Object
-
#initialize(search_name) ⇒ SitemapProcessor
constructor
A new instance of SitemapProcessor.
- #process_page(page, page_hash) ⇒ Object
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_file ⇒ Object
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 |