Module: Rhales::Utils
- Included in:
- Rhales, LoggingHelpers
- Defined in:
- lib/rhales/utils.rb,
lib/rhales/utils/logging_helpers.rb
Defined Under Namespace
Modules: LoggingHelpers
Instance Method Summary collapse
-
#now ⇒ Time
Current time in UTC.
-
#now_in_μs ⇒ Integer
(also: #now_in_microseconds)
Returns the current time in microseconds.
-
#pretty_path(filepath) ⇒ String?
The expanded absolute path, or nil if input is.
Instance Method Details
#now ⇒ Time
Returns Current time in UTC.
12 13 14 |
# File 'lib/rhales/utils.rb', line 12 def now Time.now.utc end |
#now_in_μs ⇒ Integer Also known as: now_in_microseconds
Returns the current time in microseconds. This is used to measure the duration of Database commands.
Alias: now_in_microseconds
22 23 24 |
# File 'lib/rhales/utils.rb', line 22 def now_in_μs Process.clock_gettime(Process::CLOCK_MONOTONIC, :microsecond) end |
#pretty_path(filepath) ⇒ String?
Returns The expanded absolute path, or nil if input is.
29 30 31 32 33 |
# File 'lib/rhales/utils.rb', line 29 def pretty_path(filepath) return nil if filepath.nil? Pathname.new(filepath)..to_s end |