Class: Basilisk::TermsProcessor

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

Overview

Stores page errors.

Instance Method Summary collapse

Methods inherited from CSVProcessor

#write_file

Methods inherited from Processor

#close_file

Constructor Details

#initialize(search_name, regex_terms, css_terms) ⇒ TermsProcessor

Returns a new instance of TermsProcessor.



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

def initialize(search_name, regex_terms, css_terms)
  super(search_name)
  @regex_terms = regex_terms
  @css_terms   = css_terms
  save_header_row
end

Instance Method Details

#process_page(page, page_hash) ⇒ Object



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

def process_page(page, page_hash)
  regexes   = match_regexes(page.doc)
  css_terms = match_css_terms(page.doc) 
  write_row(page, regexes, css_terms) if !regexes.empty? || !css_terms.empty?
end