Sha256: 10828f492b28e5c1b1c0b847d262c18b0899e70ff09ab0f574984f4ec5baab6b

Contents?: true

Size: 537 Bytes

Versions: 8

Compression:

Stored size: 537 Bytes

Contents

Avro::IO::DatumWriter.class_eval do
  # A string is encoded as a long followed by that many bytes of
  # UTF-8 encoded character data
  def write_string(datum)
    # The original commit used:
    #   datum = datum.encode('utf-8') if datum.respond_to? :encode
    # This always allocated a new string even if the string was already UTF-8 encoded.
    # The form below is slightly more efficient.
    datum = datum.encode(Encoding::UTF_8) if datum.respond_to?(:encode) && datum.encoding != Encoding::UTF_8
    write_bytes(datum)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
avro-patches-1.0.0.pre0 lib/avro-patches/ensure_encoding/io.rb
avro-patches-0.4.1 lib/avro-patches/ensure_encoding/io.rb
avro-patches-0.4.0 lib/avro-patches/ensure_encoding/io.rb
avro-patches-0.3.4 lib/avro-patches/ensure_encoding/io.rb
avro-patches-0.3.3 lib/avro-patches/ensure_encoding/io.rb
avro-patches-0.3.2 lib/avro-patches/ensure_encoding/io.rb
avro-patches-0.3.1 lib/avro-patches/ensure_encoding/io.rb
avro-patches-0.3.0 lib/avro-patches/ensure_encoding/io.rb