Sha256: 851e63d1778202a540a5a9f3e15d5a20e55d0b5f761de2ad85fe4da0f8875262

Contents?: true

Size: 417 Bytes

Versions: 10

Compression:

Stored size: 417 Bytes

Contents

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

  def self.to_boolean(value)
    if ["true", "True", "TRUE", true, "yes", "y", "YES", "Y"].include? value
      true
    elsif ["false", "False", "FALSE", false, "no", "n", "NO", "N"].include? value
      false
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
inspec-core-6.8.11 lib/inspec/utils/convert.rb
inspec-core-5.22.58 lib/inspec/utils/convert.rb
inspec-core-5.22.55 lib/inspec/utils/convert.rb
inspec-core-6.8.1 lib/inspec/utils/convert.rb
inspec-core-5.22.40 lib/inspec/utils/convert.rb
inspec-core-6.6.0 lib/inspec/utils/convert.rb
inspec-core-5.22.36 lib/inspec/utils/convert.rb
inspec-core-5.22.29 lib/inspec/utils/convert.rb
inspec-core-5.22.3 lib/inspec/utils/convert.rb
inspec-core-5.21.29 lib/inspec/utils/convert.rb