Module: HopTimer

Defined in:
lib/hop_timer.rb,
lib/hop_timer/version.rb

Defined Under Namespace

Classes: CheckPoint

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.eval(check_point1, check_point2, time_value = :string) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/hop_timer.rb', line 62

def self.eval(check_point1, check_point2, time_value = :string)
  time_value_validation(time_value)

  time_diff = check_point1 - check_point2

  udiff = time_diff[:u_diff]
  sdiff = time_diff[:s_diff]
  cudiff = time_diff[:cu_diff]
  csdiff = time_diff[:cs_diff]
  realdiff = time_diff[:r_diff]

  report = Benchmark::Tms.new(udiff, sdiff, cudiff, csdiff, realdiff).to_s

  values = report_to_values(report)

  log_table(values, check_point1.name, check_point2.name)

  times_to_hash(values, time_value)
end