Class: SimpleCov::CLI::Watch::Narrator
- Inherits:
-
Object
- Object
- SimpleCov::CLI::Watch::Narrator
- Defined in:
- lib/simplecov/cli/watch/narrator.rb
Instance Method Summary collapse
- #banner(server, count) ⇒ Object
- #change(changed, plan) ⇒ Object
- #failed_refresh ⇒ Object
-
#initialize(stdout, root) ⇒ Narrator
constructor
A new instance of Narrator.
- #result(before, after) ⇒ Object
- #stopping ⇒ Object
Constructor Details
Instance Method Details
#banner(server, count) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/simplecov/cli/watch/narrator.rb', line 12 def (server, count) host = Serve.url_host(server.addr.fetch(3)) @stdout.puts("watching #{count} file#{"s" unless count.eql?(1)}, " \ "serving http://#{host}:#{server.addr.fetch(1)}/") @stdout.puts("Press Ctrl-C to stop.") end |
#change(changed, plan) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/simplecov/cli/watch/narrator.rb', line 19 def change(changed, plan) named = name(changed) return @stdout.puts("#{named} changed, no recorded test touches it") unless plan.fetch(:run) @stdout.print("#{named} changed, #{action(plan.fetch(:tests))}...") end |
#failed_refresh ⇒ Object
33 34 35 |
# File 'lib/simplecov/cli/watch/narrator.rb', line 33 def failed_refresh @stdout.puts(" the report did not regenerate") end |
#result(before, after) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/simplecov/cli/watch/narrator.rb', line 26 def result(before, after) return @stdout.puts unless after delta = before ? format(" (%+.2f%%)", after - before) : "" @stdout.puts(format(" %.2f%%", after) + delta) end |
#stopping ⇒ Object
37 38 39 |
# File 'lib/simplecov/cli/watch/narrator.rb', line 37 def stopping @stdout.puts("\nsimplecov watch: stopping") end |