Class: Rgot::BenchmarkResult
- Inherits:
-
Object
- Object
- Rgot::BenchmarkResult
- Defined in:
- lib/rgot/benchmark_result.rb
Instance Method Summary collapse
-
#initialize(n: nil, t: nil) ⇒ BenchmarkResult
constructor
Ruby-2.0.0 wants default value of keyword_argument.
- #to_s ⇒ Object
Constructor Details
#initialize(n: nil, t: nil) ⇒ BenchmarkResult
Ruby-2.0.0 wants default value of keyword_argument
4 5 6 7 8 9 |
# File 'lib/rgot/benchmark_result.rb', line 4 def initialize(n: nil, t: nil) raise ArgumentError, "missing keyword: n" unless n raise ArgumentError, "missing keyword: t" unless t @n = n @t = t end |
Instance Method Details
#to_s ⇒ Object
11 12 13 |
# File 'lib/rgot/benchmark_result.rb', line 11 def to_s sprintf("%d\t%d ns/op", @n, @t / @n * 1_000_000_000) end |