Class: RspecPacmanFormatter::Pacman
- Inherits:
-
RSpec::Core::Formatters::BaseTextFormatter
- Object
- RSpec::Core::Formatters::BaseTextFormatter
- RspecPacmanFormatter::Pacman
- Defined in:
- lib/rspec_pacman_formatter/pacman.rb
Instance Attribute Summary collapse
-
#failed ⇒ Object
Returns the value of attribute failed.
-
#progress_line ⇒ Object
Returns the value of attribute progress_line.
Instance Method Summary collapse
- #close(_) ⇒ Object
- #example_failed(_) ⇒ Object
- #example_passed(_) ⇒ Object
- #example_pending(_) ⇒ Object
- #example_started(_) ⇒ Object
-
#initialize(*args) ⇒ Pacman
constructor
A new instance of Pacman.
- #start(notification) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Pacman
Returns a new instance of Pacman.
13 14 15 16 17 |
# File 'lib/rspec_pacman_formatter/pacman.rb', line 13 def initialize(*args) super @progress_line = '' @failed = 0 end |
Instance Attribute Details
#failed ⇒ Object
Returns the value of attribute failed.
11 12 13 |
# File 'lib/rspec_pacman_formatter/pacman.rb', line 11 def failed @failed end |
#progress_line ⇒ Object
Returns the value of attribute progress_line.
11 12 13 |
# File 'lib/rspec_pacman_formatter/pacman.rb', line 11 def progress_line @progress_line end |
Instance Method Details
#close(_) ⇒ Object
41 42 43 |
# File 'lib/rspec_pacman_formatter/pacman.rb', line 41 def close(_) puts 'GAME OVER' if @failed > 0 end |
#example_failed(_) ⇒ Object
32 33 34 35 |
# File 'lib/rspec_pacman_formatter/pacman.rb', line 32 def example_failed(_) @failed += 1 step('ᗣ') end |
#example_passed(_) ⇒ Object
28 29 30 |
# File 'lib/rspec_pacman_formatter/pacman.rb', line 28 def example_passed(_) step('.') end |
#example_pending(_) ⇒ Object
37 38 39 |
# File 'lib/rspec_pacman_formatter/pacman.rb', line 37 def example_pending(_) step('*') end |
#example_started(_) ⇒ Object
24 25 26 |
# File 'lib/rspec_pacman_formatter/pacman.rb', line 24 def example_started(_) step('ᗧ') end |
#start(notification) ⇒ Object
19 20 21 22 |
# File 'lib/rspec_pacman_formatter/pacman.rb', line 19 def start(notification) puts 'GAME STARTED' @progress_line = '•' * notification.count end |