Module: Benchable
- Defined in:
- lib/benchable.rb,
lib/benchable/version.rb,
lib/benchable/benchmark.rb
Overview
Benchable is used for automating benchmarks
Defined Under Namespace
Classes: Benchmark, Error
Constant Summary
collapse
- VERSION =
"0.3.1"
Class Method Summary
collapse
Class Method Details
.bench(*types, **options, &block) ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'lib/benchable.rb', line 17
def bench(*types, **options, &block)
types << :bm if types.empty?
if options.empty?
types.map { |type| build(type, &block).run }
else
types.map { |type| build(type, **options, &block).run }
end
end
|
.build(type = :bm, **options, &block) ⇒ Object
11
12
13
14
15
|
# File 'lib/benchable.rb', line 11
def build(type = :bm, **options, &block)
bench_class = Class.new(Benchmark, &block)
bench_class.new(type, **options)
end
|