Module: ConsoleUtils::BenchUtils
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/console_utils/bench_utils.rb,
lib/console_utils/bench_utils/chips.rb
Overview
:nodoc:
Defined Under Namespace
Classes: Chips
Instance Method Summary collapse
-
#chips ⇒ Object
:call-seq: chips[ .(“report”) {} | .compare! {} | … ].
Instance Method Details
#chips ⇒ Object
:call-seq:
chips[ .("report") {} | .compare! {} | ... ]
Access to globally shared Benchmark.ips
object, which works out of a block and allows to change the stack “on the fly” and to keep the result during the work.
Examples
chips.("merge") { the_hash.merge(other_hash) }
chips.("merge!") { the_hash.merge!(other_hash) }
# => x.report(..) { ... }
chips.compare! # compare two reports
# add more reports:
chips.("deep_merge") { the_hash.deep_merge(other_hash) }
# change an existing:
chips.("merge!") { the_hash.deep_merge!(other_hash) }
chips.compare! # compare three reports
# remove report labeled as "merge!":
chips.del("merge!")
# it is just a delegator of the hash:
chips # => { "merge" => #<Proc:...>, ... }
chips["merge"] # => #<Proc:...>
chips.clear # clear procs
42 43 44 |
# File 'lib/console_utils/bench_utils.rb', line 42 def chips Chips.shared end |