Module: Tach

Defined in:
lib/tach.rb

Defined Under Namespace

Classes: Meter

Constant Summary collapse

VERSION =
'0.0.8'

Class Method Summary collapse

Class Method Details

.meter(times = 1, &block) ⇒ Object



12
13
14
# File 'lib/tach.rb', line 12

def self.meter(times = 1, &block)
  Tach::Meter.new(times, &block)
end

.tach(name, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/tach.rb', line 16

def self.tach(name, &block)
  tach_start = Time.now
  instance_eval(&block)
  tach_finish = Time.now
  duration = tach_finish.to_f - tach_start.to_f
  Formatador.display_line
  Formatador.display_line("[bold]#{name}[/] [light_black]#{format("%0.6f", duration)}[/]")
  duration
end