Sha256: 4f9ebd1f7580b42ff53ec26f77f89ff9cc8713e78ac0770f552a2df2b0cf43d9
Contents?: true
Size: 591 Bytes
Versions: 1
Compression:
Stored size: 591 Bytes
Contents
require 'renc/version' # namespace module Renc def renc(obj, encoding = Encoding::UTF_8) case obj when String then obj.encode(encoding) when Hash then enc_hash(obj, encoding) when Array then enc_array(obj, encoding) else obj end end extend Gem::Deprecate alias enc renc deprecate :enc, :renc, 2016, 3 private def enc_hash(obj, encoding) obj.each_with_object({}) do |args, h| key, val = args h[key] = renc(val, encoding) end end def enc_array(obj, encoding) obj.map { |val| renc(val, encoding) } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
renc-1.0.0 | lib/renc.rb |