module Benchable
Benchable
is used for automating benchmarks
Constants
- VERSION
Public Class Methods
bench(*types, **options, &block)
click to toggle source
# 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)
click to toggle source
# File lib/benchable.rb, line 11 def build(type = :bm, **options, &block) bench_class = Class.new(Benchmark, &block) bench_class.new(type, **options) end