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
11
# File 'lib/sla/formatters/base.rb', line 8

def initialize
  @count = 0
  @failed = 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



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

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


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

def footer_prefix
  "\n"
end

#handle(action, page) ⇒ Object

Raises:

  • (NotImplementedError)


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

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

#success?Boolean

Returns:

  • (Boolean)


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

def success?
  failed == 0
end