lib/knj/arrayext.rb in knjrbfw-0.0.98 vs lib/knj/arrayext.rb in knjrbfw-0.0.99
- old
+ new
@@ -11,11 +11,11 @@
raise "No seperator given." if !args[:sep]
str = ""
first = true
- require "php4r"
+ require "php4r" if !Kernel.const_defined?(:Php4r)
Php4r.foreach(args[:arr]) do |key, value|
if first
first = false
else
str << args[:sep]
@@ -210,10 +210,10 @@
#Forces all strings in an array or a hash to be encoded to a specific encoding recursively.
def self.clone_encode(hash, encoding, args = {})
return hash if !hash
- require "php4r"
+ require "php4r" if !Kernel.const_defined?(:Php4r)
hash = hash.clone
Php4r.foreach(hash) do |key, val|
if val.is_a?(String)
begin
hash[key] = Php4r.utf8_encode(val)
\ No newline at end of file