Short-hand syntax for blocks with yield

This commit is contained in:
Michael Miller 2018-09-27 18:49:01 -06:00
parent d670d96045
commit 4948fe0c6f
3 changed files with 7 additions and 7 deletions

View file

@ -17,11 +17,11 @@ module Spectator
end
def examples : Enumerable(Example)
children.compact_map { |child| child.as?(Example) }
children.compact_map &.as?(Example)
end
def groups : Enumerable(ExampleGroup)
children.compact_map { |child| child.as?(ExampleGroup) }
children.compact_map &.as?(ExampleGroup)
end
def example_count

View file

@ -20,19 +20,19 @@ module Spectator
end
def run_before_all
@before_all.each(&.call)
@before_all.each &.call
end
def run_before_each
@before_each.each(&.call)
@before_each.each &.call
end
def run_after_all
@after_all.each(&.call)
@after_all.each &.call
end
def run_after_each
@after_each.each(&.call)
@after_each.each &.call
end
def wrap_around_each(&block : ->)

View file

@ -37,7 +37,7 @@ module Spectator
end
def example_runtime
@results.map { |result| result.elapsed }.sum
@results.map(&.elapsed).sum
end
def overhead_time