lib/ting_yun/support/coerce.rb in tingyun_rpm-1.3.1 vs lib/ting_yun/support/coerce.rb in tingyun_rpm-1.4.1
- old
+ new
@@ -43,9 +43,14 @@
rescue => error
log_failure(value.class, String, context, error)
""
end
+ def url_encode(s)
+ s.to_s.b.gsub(/[^a-zA-Z0-9_\-.]/n) { |m|
+ sprintf("%%%02X", m.unpack("C")[0])
+ }
+ end
# Convert a hash into a format acceptable to be included with Transaction
# event data.
#
# We accept a hash and will return a new hash where all of the keys
# have been converted to strings. As values we only allow Strings,