+ # Converts a string into a boolean value
+ # Strings matching 1,y,yes,true or t will return TrueClass
+ # Any other value will return FalseClass
+ def self.str_to_bool(val)
+ clean_val = val.to_s.strip
+ if clean_val =~ /^(1|yes|true|y|t)$/i
+ return true
+ elsif clean_val =~ /^(0|no|false|n|f)$/i
+ return false
+ else
+ raise_code(:PLMC42, "Cannot convert string value '%{value}' into a boolean.", :error, :value => clean_val)
+ end
+ end
+