diff options
author | Keith Bennett <[email protected]> | 2021-02-07 23:02:52 -0500 |
---|---|---|
committer | Marc-Andre Lafortune <[email protected]> | 2021-02-07 23:06:17 -0500 |
commit | 3a7ff66abc0c389851ab3c5cd0ac53ebe0647eec (patch) | |
tree | ef87c3b97cde2796211d4c385faafd67d14ecf58 /lib/benchmark.rb | |
parent | 9328112b9d6622e57eb348a0241d925271486e29 (diff) |
[ruby/benchmark] Adds `Tms#to_h`
[Feature #17601]
Diffstat (limited to 'lib/benchmark.rb')
-rw-r--r-- | lib/benchmark.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/benchmark.rb b/lib/benchmark.rb index 5ce9710586..4cfc0d8a5b 100644 --- a/lib/benchmark.rb +++ b/lib/benchmark.rb @@ -527,6 +527,20 @@ module Benchmark [@label, @utime, @stime, @cutime, @cstime, @real] end + # + # Returns a hash containing the same data as `to_a`. + # + def to_h + { + label: @label, + utime: @utime, + stime: @stime, + cutime: @cutime, + cstime: @cstime, + real: @real + } + end + protected # |