Class: Polling::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/polling/utils.rb

Class Method Summary collapse

Class Method Details

.convert(value) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/polling/utils.rb', line 4

def convert(value)
  case value
  when /(\d+)s/
    value = $1.to_i
  when /(\d+)m/
    value = $1.to_i*60
  when /(\d+)h/
    value = $1.to_i*60*60
  when /(\d+)d/
    value = $1.to_i*60*60*24
  when String
    value = value.to_i
  end
  return value
end