Sha256: 25c8f534558484d573dfd4e17efe80d999df6da84849e080c1976a8273f41306

Contents?: true

Size: 410 Bytes

Versions: 4

Compression:

Stored size: 410 Bytes

Contents

# frozen_string_literal: true

module RangeScan
  class Utils
    class << self
      def to_utf8(obj)
        return obj.dup.force_encoding(Encoding::UTF_8) if obj.is_a?(String)

        obj.map do |k, v|
          k = k.dup.force_encoding(Encoding::UTF_8) if k.is_a?(String)
          v = v.dup.force_encoding(Encoding::UTF_8) if v.is_a?(String)
          [k, v]
        end.to_h
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rangescan-0.3.0 lib/rangescan/utils.rb
rangescan-0.2.0 lib/rangescan/utils.rb
rangescan-0.1.4 lib/rangescan/utils.rb
rangescan-0.1.3 lib/rangescan/utils.rb