Class: Dry::Logger::Clock Private
- Inherits:
-
Object
- Object
- Dry::Logger::Clock
- Defined in:
- lib/dry/logger/clock.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #unit ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(unit: :nanosecond) ⇒ Clock
constructor
private
A new instance of Clock.
- #measure ⇒ Object private
- #now ⇒ Object private
- #now_utc ⇒ Object private
Constructor Details
#initialize(unit: :nanosecond) ⇒ Clock
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Clock.
14 15 16 |
# File 'lib/dry/logger/clock.rb', line 14 def initialize(unit: :nanosecond) @unit = unit end |
Instance Attribute Details
#unit ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/dry/logger/clock.rb', line 10 def unit @unit end |
Instance Method Details
#measure ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 35 36 |
# File 'lib/dry/logger/clock.rb', line 32 def measure start = current result = yield [result, current - start] end |
#now ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 |
# File 'lib/dry/logger/clock.rb', line 20 def now Time.now end |
#now_utc ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/dry/logger/clock.rb', line 26 def now_utc now.getutc end |