Module: Converter

Included in:
Inspec::Resources::EtcGroup, Inspec::Resources::InterfaceInfo, Inspec::Resources::UserInfo
Defined in:
lib/inspec/utils/convert.rb

Instance Method Summary collapse

Instance Method Details

#convert_to_i(val) ⇒ Object

convert the value to an integer if we have numbers only otherwise we return the string



4
5
6
7
# File 'lib/inspec/utils/convert.rb', line 4

def convert_to_i(val)
  val = val.to_i if val =~ /^\d+$/
  val
end