Sha256: f977c4138b70974f982fe468c841ff7dd8239802058550775a0a4b7514dde351
Contents?: true
Size: 619 Bytes
Versions: 106
Compression:
Stored size: 619 Bytes
Contents
module Temple module Filters # Try to encode input string # # @api public class Encoding < Parser define_options encoding: 'utf-8' def call(s) if options[:encoding] && s.respond_to?(:encoding) old_enc = s.encoding s = s.dup if s.frozen? s.force_encoding(options[:encoding]) # Fall back to old encoding if new encoding is invalid unless s.valid_encoding? s.force_encoding(old_enc) s.force_encoding(::Encoding::BINARY) unless s.valid_encoding? end end s end end end end
Version data entries
106 entries across 92 versions & 7 rubygems