Sha256: 33b6fa9f8bd33619637f7b6f56dfe19ae91b052e7d9642b639ae1203e150e114
Contents?: true
Size: 505 Bytes
Versions: 3
Compression:
Stored size: 505 Bytes
Contents
# frozen_string_literal: true module Lrama class Report module Duration def self.enable @_report_duration_enabled = true end def self.enabled? !!@_report_duration_enabled end def report_duration(method_name) time1 = Time.now.to_f result = yield time2 = Time.now.to_f if Duration.enabled? puts sprintf("%s %10.5f s", method_name, time2 - time1) end return result end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lrama-0.7.0 | lib/lrama/report/duration.rb |
lrama-0.6.11 | lib/lrama/report/duration.rb |
lrama-0.6.10 | lib/lrama/report/duration.rb |