Class: SLA::Formatters::Simple

Inherits:
Base
  • Object
show all
Defined in:
lib/sla/formatters/simple.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#count, #failed

Instance Method Summary collapse

Methods inherited from Base

#footer, #footer_prefix, #initialize, #success?

Constructor Details

This class inherits a constructor from SLA::Formatters::Base

Instance Attribute Details

#last_sourceObject (readonly)

Returns the value of attribute last_source.



4
5
6
# File 'lib/sla/formatters/simple.rb', line 4

def last_source
  @last_source
end

Instance Method Details

#handle(action, page) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/sla/formatters/simple.rb', line 6

def handle(action, page)
  @last_source = page.url if action == :source

  return unless action == :check
  @count += 1

  return if page.valid?

  @failed += 1

  if last_source
    say "!txtpur!SOURCE  #{last_source}"
    @last_source = nil
  end

  say "  !txtred!FAIL!txtrst!  #{page.depth}  #{page.url}"
  say "   !txtred!#{page.code}!txtrst!  #{page.error}" unless page.code == 404
end