class ElasticAPM::Config::Duration
@api private
Constants
- MULTIPLIERS
- REGEX
Attributes
seconds[RW]
Public Class Methods
new(seconds)
click to toggle source
# File lib/elastic_apm/config/duration.rb, line 9 def initialize(seconds) @seconds = seconds end
parse(str, default_unit:)
click to toggle source
# File lib/elastic_apm/config/duration.rb, line 15 def self.parse(str, default_unit:) _, negative, amount, unit = REGEX.match(str).to_a unit ||= default_unit seconds = MULTIPLIERS.fetch(unit.downcase, 1) * amount.to_i seconds = 0 - seconds if negative new(seconds) end