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 |
# File 'lib/sla/formatters/base.rb', line 8 def initialize @count, @failed = 0, 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
26 27 28 29 |
# File 'lib/sla/formatters/base.rb', line 26 def color = success? ? '!txtgrn!' : '!txtred!' say "#{}#{color}Checked #{count} pages with #{failed} failures" end |
#footer_prefix ⇒ Object
22 23 24 |
# File 'lib/sla/formatters/base.rb', line 22 def "\n" end |
#handle(action, page) ⇒ Object
16 17 18 19 20 |
# File 'lib/sla/formatters/base.rb', line 16 def handle(action, page) # :nocov: raise NotImplementedError # :nocov: end |
#success? ⇒ Boolean
12 13 14 |
# File 'lib/sla/formatters/base.rb', line 12 def success? count > 0 and failed == 0 end |