You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2011/03/31 01:10:33 UTC
svn commit: r1087129 - in /avro/trunk: CHANGES.txt lang/ruby/lib/avro.rb
lang/ruby/lib/avro/io.rb lang/ruby/lib/avro/ipc.rb
lang/ruby/lib/avro/schema.rb lang/ruby/test/test_io.rb
Author: cutting
Date: Wed Mar 30 23:10:33 2011
New Revision: 1087129
URL: http://svn.apache.org/viewvc?rev=1087129&view=rev
Log:
AVRO-787. Ruby: Make compatible with Ruby 1.9. Contributed by Michael L. Artz.
Modified:
avro/trunk/CHANGES.txt
avro/trunk/lang/ruby/lib/avro.rb
avro/trunk/lang/ruby/lib/avro/io.rb
avro/trunk/lang/ruby/lib/avro/ipc.rb
avro/trunk/lang/ruby/lib/avro/schema.rb
avro/trunk/lang/ruby/test/test_io.rb
Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1087129&r1=1087128&r2=1087129&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Wed Mar 30 23:10:33 2011
@@ -19,10 +19,12 @@ Avro 1.5.1 (unreleased)
AVRO-781. Generic data support in C++. (thiru)
- AVRO-783. Specifc object support in C++. (thiru)
+ AVRO-783. Specific object support in C++. (thiru)
AVRO-789. Datafile support in C++. (thiru)
+ AVRO-787. Ruby: Make compatible with Ruby 1.9. (Michael L. Artz via cutting)
+
BUG FIXES
AVRO-786. Java: Fix equals() to work on objects containing maps. (cutting)
Modified: avro/trunk/lang/ruby/lib/avro.rb
URL: http://svn.apache.org/viewvc/avro/trunk/lang/ruby/lib/avro.rb?rev=1087129&r1=1087128&r2=1087129&view=diff
==============================================================================
--- avro/trunk/lang/ruby/lib/avro.rb (original)
+++ avro/trunk/lang/ruby/lib/avro.rb Wed Mar 30 23:10:33 2011
@@ -16,7 +16,7 @@
require 'yajl'
require 'set'
-require 'md5'
+require 'digest/md5'
require 'net/http'
require 'stringio'
Modified: avro/trunk/lang/ruby/lib/avro/io.rb
URL: http://svn.apache.org/viewvc/avro/trunk/lang/ruby/lib/avro/io.rb?rev=1087129&r1=1087128&r2=1087129&view=diff
==============================================================================
--- avro/trunk/lang/ruby/lib/avro/io.rb (original)
+++ avro/trunk/lang/ruby/lib/avro/io.rb Wed Mar 30 23:10:33 2011
@@ -43,9 +43,9 @@ module Avro
end
def byte!
- @reader.read(1)[0]
+ @reader.read(1).unpack('C').first
end
-
+
def read_null
# null is written as zero byte's
nil
Modified: avro/trunk/lang/ruby/lib/avro/ipc.rb
URL: http://svn.apache.org/viewvc/avro/trunk/lang/ruby/lib/avro/ipc.rb?rev=1087129&r1=1087128&r2=1087129&view=diff
==============================================================================
--- avro/trunk/lang/ruby/lib/avro/ipc.rb (original)
+++ avro/trunk/lang/ruby/lib/avro/ipc.rb Wed Mar 30 23:10:33 2011
@@ -399,7 +399,7 @@ module Avro::IPC
message_length = message.size
total_bytes_sent = 0
while message_length - total_bytes_sent > 0
- if message_length - total_bytes_sent > BUFFER_SIZE:
+ if message_length - total_bytes_sent > BUFFER_SIZE
buffer_length = BUFFER_SIZE
else
buffer_length = message_length - total_bytes_sent
Modified: avro/trunk/lang/ruby/lib/avro/schema.rb
URL: http://svn.apache.org/viewvc/avro/trunk/lang/ruby/lib/avro/schema.rb?rev=1087129&r1=1087128&r2=1087129&view=diff
==============================================================================
--- avro/trunk/lang/ruby/lib/avro/schema.rb (original)
+++ avro/trunk/lang/ruby/lib/avro/schema.rb Wed Mar 30 23:10:33 2011
@@ -102,7 +102,7 @@ module Avro
when 'array'
datum.is_a?(Array) &&
datum.all?{|d| validate(expected_schema.items, d) }
- when 'map':
+ when 'map'
datum.keys.all?{|k| k.is_a? String } &&
datum.values.all?{|v| validate(expected_schema.values, v) }
when 'union'
Modified: avro/trunk/lang/ruby/test/test_io.rb
URL: http://svn.apache.org/viewvc/avro/trunk/lang/ruby/test/test_io.rb?rev=1087129&r1=1087128&r2=1087129&view=diff
==============================================================================
--- avro/trunk/lang/ruby/test/test_io.rb (original)
+++ avro/trunk/lang/ruby/test/test_io.rb Wed Mar 30 23:10:33 2011
@@ -145,7 +145,7 @@ EOS
bytes = []
current_byte = reader.read(1)
bytes << hexlify(current_byte)
- while (current_byte[0] & 0x80) != 0
+ while (current_byte.unpack('C').first & 0x80) != 0
current_byte = reader.read(1)
bytes << hexlify(current_byte)
end
@@ -153,7 +153,7 @@ EOS
end
def hexlify(msg)
- msg.split("").collect { |c| c[0].to_s(16).rjust(2, '0') }.join
+ msg.unpack("H*")
end
def test_binary_int_encoding