Class: Checkers::Run
- Inherits:
-
Object
- Object
- Checkers::Run
- Defined in:
- lib/checkers.rb
Instance Attribute Summary collapse
-
#failures ⇒ Object
readonly
Returns the value of attribute failures.
-
#passes ⇒ Object
readonly
Returns the value of attribute passes.
-
#printer ⇒ Object
readonly
Returns the value of attribute printer.
Instance Method Summary collapse
- #fail(check) ⇒ Object
- #failed? ⇒ Boolean
-
#initialize(printer) ⇒ Run
constructor
A new instance of Run.
- #pass(check) ⇒ Object
- #status ⇒ Object
- #summary ⇒ Object
Constructor Details
#initialize(printer) ⇒ Run
Returns a new instance of Run.
142 143 144 145 146 |
# File 'lib/checkers.rb', line 142 def initialize(printer) @failures = [] @passes = [] @printer = printer end |
Instance Attribute Details
#failures ⇒ Object (readonly)
Returns the value of attribute failures.
140 141 142 |
# File 'lib/checkers.rb', line 140 def failures @failures end |
#passes ⇒ Object (readonly)
Returns the value of attribute passes.
140 141 142 |
# File 'lib/checkers.rb', line 140 def passes @passes end |
#printer ⇒ Object (readonly)
Returns the value of attribute printer.
140 141 142 |
# File 'lib/checkers.rb', line 140 def printer @printer end |
Instance Method Details
#fail(check) ⇒ Object
153 154 155 156 |
# File 'lib/checkers.rb', line 153 def fail(check) failures << check printer.fail check end |
#failed? ⇒ Boolean
158 159 160 |
# File 'lib/checkers.rb', line 158 def failed? !failures.empty? end |
#pass(check) ⇒ Object
148 149 150 151 |
# File 'lib/checkers.rb', line 148 def pass(check) passes << check printer.pass check end |
#status ⇒ Object
162 163 164 |
# File 'lib/checkers.rb', line 162 def status failed? ? 0 : 1 end |
#summary ⇒ Object
166 167 168 |
# File 'lib/checkers.rb', line 166 def summary printer.summary passes, failures end |