inspec/lib/utils/convert.rb

13 lines
269 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)
val = val.to_i if val.match(/^\d+$/)
val
end
end