Sha256: 8c9c89f26d2b8cd82e27d47b5633f01fa9740ffd22adb1cac1fea968bcc3ff18

Contents?: true

Size: 277 Bytes

Versions: 6

Compression:

Stored size: 277 Bytes

Contents

# encoding: utf-8
# 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 =~ /^\d+$/
    val
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
inspec-2.1.81 lib/utils/convert.rb
inspec-2.1.21 lib/utils/convert.rb
inspec-2.1.10 lib/utils/convert.rb
inspec-2.0.32 lib/utils/convert.rb
inspec-2.0.17 lib/utils/convert.rb
inspec-1.51.15 lib/utils/convert.rb