2
0
Fork 0
mirror of https://github.com/inspec/inspec synced 2025-02-25 20:07:25 +00:00
inspec/lib/utils/convert.rb

13 lines
269 B
Ruby
Raw Normal View History

# encoding: utf-8
2015-10-06 18:55:44 +02: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