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.
31 32 33 |
# File 'lib/benchmark/http/seconds.rb', line 31 def initialize(value) @value = value end |
Class Method Details
.[](value) ⇒ Object
27 28 29 |
# File 'lib/benchmark/http/seconds.rb', line 27 def self.[](value) self.new(value) end |
Instance Method Details
#scale ⇒ Object
35 36 37 |
# File 'lib/benchmark/http/seconds.rb', line 35 def scale Math.log(@value) / Math.log(1000) end |