Class: Benchmark::HTTP::Seconds
- Inherits:
-
Object
- Object
- Benchmark::HTTP::Seconds
- Defined in:
- lib/benchmark/http/seconds.rb
Constant Summary collapse
- UNITS =
["s", "ms", "µs"]
- SCALE =
UNITS.size - 1
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value) ⇒ Seconds
constructor
A new instance of Seconds.
- #scale ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(value) ⇒ Seconds
Returns a new instance of Seconds.
16 17 18 |
# File 'lib/benchmark/http/seconds.rb', line 16 def initialize(value) @value = value end |
Class Method Details
.[](value) ⇒ Object
12 13 14 |
# File 'lib/benchmark/http/seconds.rb', line 12 def self.[](value) self.new(value) end |
Instance Method Details
#scale ⇒ Object
20 21 22 |
# File 'lib/benchmark/http/seconds.rb', line 20 def scale Math.log(@value) / Math.log(1000) end |