Module: Dots
Overview
Dots makes dots.
Defined Under Namespace
Classes: InvalidDot
Constant Summary collapse
- VERSION =
"0.0.2"
- @@dots =
– How dots appear. ++
{ "." => ".", "F" => "F", "E" => "E" }
Instance Method Summary collapse
-
#[](key) ⇒ Object
Access how a dot should appear.
-
#[]=(key, value) ⇒ Object
Configure how dots appear.
-
#report(exceptions, passed = 0, start = nil, io = $stdout) ⇒ Object
Formats reports for
each_with_dots
.
Instance Method Details
#[](key) ⇒ Object
Access how a dot should appear.
20 21 22 23 24 |
# File 'lib/dots.rb', line 20 def [](key) raise InvalidDot unless @@dots.keys.include? key.to_s dot = @@dots[key.to_s] dot.respond_to?(:call) ? dot.call : dot end |
#[]=(key, value) ⇒ Object
37 38 39 40 |
# File 'lib/dots.rb', line 37 def []=(key, value) raise InvalidDot unless @@dots.keys.include? key.to_s @@dots[key.to_s] = value end |
#report(exceptions, passed = 0, start = nil, io = $stdout) ⇒ Object
Formats reports for each_with_dots
.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/dots.rb', line 135 def report(exceptions, passed = 0, start = nil, io = $stdout) failed = erred = 0 io.puts io.puts "Finished in #{Time.now - start} seconds." unless start.nil? exceptions.each_with_index do |(o, e), i| io.puts if e.is_a? RuntimeError failed += 1 io.puts "%3d) Failure" % [i + 1] io.puts "#{e.} " unless e..empty? io.puts "with <#{o.inspect}>" io.puts "[#{e.backtrace.first[/.+\d+/]}]" else erred += 1 io.puts "%3d) Error" % [i + 1] io.puts "#{e.class.name}: #{e.}" io.puts "with <#{o.inspect}>" io.puts e.backtrace.select { |l| l !~ /dots.rb/ }.map { |l| "\t#{l}" } end end io.puts io.puts summary(passed, failed, erred) end |