Module: Converter
- Included in:
- Inspec::Resources::EtcGroup, Inspec::Resources::InterfaceInfo, Inspec::Resources::UserInfo
- Defined in:
- lib/inspec/utils/convert.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#convert_to_i(val) ⇒ Object
convert the value to an integer if we have numbers only otherwise we return the string.
Class Method Details
.to_boolean(value) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/inspec/utils/convert.rb', line 9 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 |
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 |