Class: SLA::Formatters::Base
- Inherits:
-
Object
- Object
- SLA::Formatters::Base
- Includes:
- Colsole
- Defined in:
- lib/sla/formatters/base.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#failed ⇒ Object
Returns the value of attribute failed.
Instance Method Summary collapse
- #footer ⇒ Object
- #footer_prefix ⇒ Object
- #handle(action, page) ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #success? ⇒ Boolean
Constructor Details
#initialize ⇒ Base
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
#count ⇒ Object
Returns the value of attribute count.
6 7 8 |
# File 'lib/sla/formatters/base.rb', line 6 def count @count end |
#failed ⇒ Object
Returns the value of attribute failed.
6 7 8 |
# File 'lib/sla/formatters/base.rb', line 6 def failed @failed end |
Instance Method Details
#footer ⇒ Object
27 28 29 30 |
# File 'lib/sla/formatters/base.rb', line 27 def color = success? ? '!txtgrn!' : '!txtred!' say "#{footer_prefix}#{color}Checked #{count} pages with #{failed} failures" end |
#footer_prefix ⇒ Object
23 24 25 |
# File 'lib/sla/formatters/base.rb', line 23 def "\n" end |
#handle(action, page) ⇒ Object
17 18 19 20 21 |
# File 'lib/sla/formatters/base.rb', line 17 def handle(action, page) # :nocov: raise NotImplementedError # :nocov: end |
#success? ⇒ Boolean
13 14 15 |
# File 'lib/sla/formatters/base.rb', line 13 def success? failed == 0 end |