lib/knj/strings.rb in knjrbfw-0.0.72 vs lib/knj/strings.rb in knjrbfw-0.0.74

- old
+ new

@@ -1,7 +1,9 @@ #encoding: utf-8 +require "php4r" + #This module contains various methods to escape, change or treat strings. module Knj::Strings #Returns a string that is safe to use on the command line. def self.UnixSafe(tha_string) return tha_string.to_s.gsub(" ", "\\ ").gsub("&", "\&").gsub("(", "\\(").gsub(")", "\\)").gsub('"', '\"').gsub("\n", "\"\n\"").gsub(":", "\\:").gsub('\'', "\\\\'").gsub("`", "\\\\`") @@ -119,10 +121,10 @@ return str end #Returns 'Yes' or 'No' based on a value. The value can be 0, 1, yes, no, true or false. def self.yn_str(value, str_yes = "Yes", str_no = "No") - value = value.to_i if Knj::Php.is_numeric(value) + value = value.to_i if Php4r.is_numeric(value) value_s = value.to_s if value.is_a?(Integer) if value == 0 return str_no \ No newline at end of file