Sha256: e5120a92827f3e36a49366940666da17e0436356198382c4e7db369d59d3ab31

Contents?: true

Size: 411 Bytes

Versions: 5

Compression:

Stored size: 411 Bytes

Contents

module Polling
  class Utils
    class << self
      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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
polling-0.1.5 lib/polling/utils.rb
polling-0.1.4 lib/polling/utils.rb
polling-0.1.3 lib/polling/utils.rb
polling-0.1.2 lib/polling/utils.rb
polling-0.1.1 lib/polling/utils.rb