lib/cacheflow.rb in cacheflow-0.3.3 vs lib/cacheflow.rb in cacheflow-0.4.0

- old
+ new

@@ -28,10 +28,17 @@ require_relative "cacheflow/sidekiq" end # private def self.args(args) - args.map { |v| v.to_s.dup.force_encoding(Encoding::UTF_8).valid_encoding? ? v : "<binary-data>" }.join(" ") + args.map { |v| binary?(v) ? "<binary-data>" : v }.join(" ") + end + + # private + def self.binary?(v) + v = v.to_s + # string encoding creates false positives, so try to determine based on value + v.include?("\x00") || !v.dup.force_encoding(Encoding::UTF_8).valid_encoding? end end if defined?(Rails) require_relative "cacheflow/railtie"