Method: String#unit_factor
- Defined in:
- lib/wavefront-cli/stdlib/string.rb
#unit_factor(unit) ⇒ Integer
How many seconds in the given unit
87 88 89 90 |
# File 'lib/wavefront-cli/stdlib/string.rb', line 87 def unit_factor(unit) factors = { s: 1, m: 60, h: 3600, d: 86_400, w: 604_800 } factors[unit] || 1 end |