Class: Headhunter::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/headhunter/runner.rb

Constant Summary collapse

ASSETS_PATH =
'public/assets'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ Runner



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/headhunter/runner.rb', line 9

def initialize(root)
  @root             = root
  @temporary_assets = []

  precompile_assets!

  @html_validator = HtmlValidator.new
  @css_hunter     = CssHunter.new(stylesheets)

  @css_validator = CssValidator.new(stylesheets)
end

Instance Attribute Details

#resultsObject

Returns the value of attribute results.



7
8
9
# File 'lib/headhunter/runner.rb', line 7

def results
  @results
end

Instance Method Details

#clean_up!Object



26
27
28
29
30
# File 'lib/headhunter/runner.rb', line 26

def clean_up!
  print "Headhunter is removing precompiled assets...".yellow
  remove_assets!
  puts " done!".yellow
end

#process(url, html) ⇒ Object



21
22
23
24
# File 'lib/headhunter/runner.rb', line 21

def process(url, html)
  @html_validator.validate(url, html)
  @css_hunter.process(html)
end

#reportObject



32
33
34
35
36
37
38
39
# File 'lib/headhunter/runner.rb', line 32

def report
  puts [ @html_validator.statistics,
         @css_validator.statistics,
         @css_hunter.statistics
       ].join "\n\n"

 puts
end