Class: Basilisk::SeoProcessor

Inherits:
CSVProcessor show all
Defined in:
lib/basilisk/processors/seo_processor.rb

Overview

Write a csv containing important seo fields: title, h1, h2, description, and keywords.

Constant Summary collapse

HTMLTags =
['title', 'h1', 'h2']
MetaTags =
['description', 'keywords']

Instance Method Summary collapse

Methods inherited from CSVProcessor

#write_file

Methods inherited from Processor

#close_file

Constructor Details

#initialize(search_name) ⇒ SeoProcessor

Returns a new instance of SeoProcessor.



7
8
9
10
# File 'lib/basilisk/processors/seo_processor.rb', line 7

def initialize(search_name)
  super
  save_header_row
end

Instance Method Details

#process_page(page, page_hash) ⇒ Object



12
13
14
15
16
17
# File 'lib/basilisk/processors/seo_processor.rb', line 12

def process_page(page, page_hash)
  @tags = Hash.new("")
  HTMLTags.each { |tag_name|  check_html_element(tag_name, page.doc) }
  MetaTags.each { |meta_name| check_meta_element(meta_name, page.doc) }
  save_tag_row(page)
end