Sha256: eba011153c30ec678a42b52a4e21efe7826acff367721f3737489bd61a0cb58c

Contents?: true

Size: 701 Bytes

Versions: 1

Compression:

Stored size: 701 Bytes

Contents

require 'benchin/version'
require 'benchin/wrap'

# Benchmarking toolset.
#
# @example Using {Wrap} global instance
#   Benchin.wrap.reset
#   Benchin.wrap.call('Expesive Code') do
#     expesive_logic
#     10.times do
#       Benchin.wrap.call('Nested Hot Operation') { do_something }
#     end
#   end
#
#   puts Benchin.wrap
#
# @see Wrap
module Benchin
  # Base error class
  class Error < StandardError; end

  class << self
    # Returns global instance of {Wrap}.
    #
    # It can be used to simplify usage when you have
    # to wrap code in many different places in your project.
    #
    # @see Wrap
    # @return [Wrap]
    def wrap
      @wrap ||= Wrap.new('GLOBAL')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
benchin-0.1.0 lib/benchin.rb