Class: SLA::Formatters::Base

Inherits:
Object
  • Object
show all
Includes:
Colsole
Defined in:
lib/sla/formatters/base.rb

Direct Known Subclasses

Simple, TTY, Verbose

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



8
9
10
# File 'lib/sla/formatters/base.rb', line 8

def initialize
  @count, @failed = 0, 0
end

Instance Attribute Details

#countObject

Returns the value of attribute count.



6
7
8
# File 'lib/sla/formatters/base.rb', line 6

def count
  @count
end

#failedObject

Returns the value of attribute failed.



6
7
8
# File 'lib/sla/formatters/base.rb', line 6

def failed
  @failed
end

Instance Method Details



26
27
28
29
# File 'lib/sla/formatters/base.rb', line 26

def footer
  color = success? ? '!txtgrn!' : '!txtred!'
  say "#{footer_prefix}#{color}Checked #{count} pages with #{failed} failures"
end


22
23
24
# File 'lib/sla/formatters/base.rb', line 22

def footer_prefix
  "\n"
end

#handle(action, page) ⇒ Object

Raises:

  • (NotImplementedError)


16
17
18
19
20
# File 'lib/sla/formatters/base.rb', line 16

def handle(action, page)
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#success?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/sla/formatters/base.rb', line 12

def success?
  count > 0 and failed == 0
end