inspec/lib/utils/convert.rb

13 lines
265 B
Ruby
Raw Normal View History

# encoding: utf-8
2015-10-06 16:55:44 +00:00
# author: Dominik Richter
# author: Christoph Hartmann
module Converter
# convert the value to an integer if we have numbers only
# otherwise we return the string
def convert_to_i(val)
2016-01-15 02:59:00 +00:00
val = val.to_i if val =~ /^\d+$/
val
end
end