File: float_duration.rb

package info (click to toggle)
ruby-test-prof 0.12.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 508 kB
  • sloc: ruby: 4,075; makefile: 4
file content (13 lines) | stat: -rw-r--r-- 262 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

module TestProf
  # Extend Float with #duration method
  module FloatDuration
    refine Float do
      def duration
        t = self
        format("%02d:%02d.%03d", t / 60, t % 60, t.modulo(1) * 1000)
      end
    end
  end
end