You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by to...@apache.org on 2015/07/07 15:23:33 UTC

svn commit: r1689660 - in /avro/trunk: CHANGES.txt lang/ruby/lib/avro/data_file.rb lang/ruby/lib/avro/io.rb

Author: tomwhite
Date: Tue Jul  7 13:23:32 2015
New Revision: 1689660

URL: http://svn.apache.org/r1689660
Log:
AVRO-1559. Drop support for Ruby 1.8. Contributed by Willem van Bergen.

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/ruby/lib/avro/data_file.rb
    avro/trunk/lang/ruby/lib/avro/io.rb

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1689660&r1=1689659&r2=1689660&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Tue Jul  7 13:23:32 2015
@@ -18,6 +18,8 @@ Trunk (not yet released)
     artifacts. To use with Hadoop 1, set the classifier to hadoop1.
     (tomwhite)
 
+    AVRO-1559. Drop support for Ruby 1.8. (Willem van Bergen via tomwhite)
+
   NEW FEATURES
 
     AVRO-1555.  C#: Add support for RPC over HTTP. (Dmitry Kovalev via cutting)

Modified: avro/trunk/lang/ruby/lib/avro/data_file.rb
URL: http://svn.apache.org/viewvc/avro/trunk/lang/ruby/lib/avro/data_file.rb?rev=1689660&r1=1689659&r2=1689660&view=diff
==============================================================================
--- avro/trunk/lang/ruby/lib/avro/data_file.rb (original)
+++ avro/trunk/lang/ruby/lib/avro/data_file.rb Tue Jul  7 13:23:32 2015
@@ -19,9 +19,8 @@ require 'openssl'
 module Avro
   module DataFile
     VERSION = 1
-    MAGIC = "Obj" + [VERSION].pack('c')
-    MAGIC.force_encoding('BINARY') if MAGIC.respond_to?(:force_encoding)
-    MAGIC_SIZE = MAGIC.respond_to?(:bytesize) ? MAGIC.bytesize : MAGIC.size
+    MAGIC = ("Obj" + [VERSION].pack('c')).force_encoding('BINARY')
+    MAGIC_SIZE = MAGIC.bytesize
     SYNC_SIZE = 16
     SYNC_INTERVAL = 4000 * SYNC_SIZE
     META_SCHEMA = Schema.parse('{"type": "map", "values": "bytes"}')
@@ -183,7 +182,7 @@ module Avro
           # write number of items in block and block size in bytes
           encoder.write_long(block_count)
           to_write = codec.compress(buffer_writer.string)
-          encoder.write_long(to_write.respond_to?(:bytesize) ? to_write.bytesize : to_write.size)
+          encoder.write_long(to_write.bytesize)
 
           # write block contents
           writer.write(to_write)

Modified: avro/trunk/lang/ruby/lib/avro/io.rb
URL: http://svn.apache.org/viewvc/avro/trunk/lang/ruby/lib/avro/io.rb?rev=1689660&r1=1689659&r2=1689660&view=diff
==============================================================================
--- avro/trunk/lang/ruby/lib/avro/io.rb (original)
+++ avro/trunk/lang/ruby/lib/avro/io.rb Tue Jul  7 13:23:32 2015
@@ -97,7 +97,7 @@ module Avro
         # A string is encoded as a long followed by that many bytes of
         # UTF-8 encoded character data.
         read_bytes.tap do |string|
-          string.force_encoding("UTF-8") if string.respond_to? :force_encoding
+          string.force_encoding("UTF-8")
         end
       end