Skip to content

Commit 9e9f0e8

Browse files
committed
Revert AVRO-1559. Drop support for Ruby 1.8.
git-svn-id: https://svn.apache.org/repos/asf/avro/trunk@1689710 13f79535-47bb-0310-9956-ffa450edef68
1 parent ba10e8b commit 9e9f0e8

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

BUILD.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The following packages must be installed before Avro can be built:
1111
- C++: cmake 2.8.4 or greater, g++, flex, bison, libboost-dev
1212
- C#: mono-devel mono-gmcs nunit
1313
- JavaScript: nodejs, npm
14-
- Ruby: ruby 2.0 or greater, ruby-dev, gem, rake, echoe, yajl-ruby
14+
- Ruby: ruby 1.86 or greater, ruby-dev, gem, rake, echoe, yajl-ruby
1515
- Perl: perl 5.8.1 or greater, gmake, Module::Install,
1616
Module::Install::ReadmeFromPod, Module::Install::Repository,
1717
Math::BigInt, JSON::XS, Try::Tiny, Regexp::Common, Encode,

CHANGES.txt

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ Trunk (not yet released)
1818
artifacts. To use with Hadoop 1, set the classifier to hadoop1.
1919
(tomwhite)
2020

21-
AVRO-1559. Drop support for Ruby 1.8. (Willem van Bergen via tomwhite)
22-
2321
NEW FEATURES
2422

2523
AVRO-1555. C#: Add support for RPC over HTTP. (Dmitry Kovalev via cutting)

lang/ruby/lib/avro/data_file.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
module Avro
2020
module DataFile
2121
VERSION = 1
22-
MAGIC = ("Obj" + [VERSION].pack('c')).force_encoding('BINARY')
23-
MAGIC_SIZE = MAGIC.bytesize
22+
MAGIC = "Obj" + [VERSION].pack('c')
23+
MAGIC.force_encoding('BINARY') if MAGIC.respond_to?(:force_encoding)
24+
MAGIC_SIZE = MAGIC.respond_to?(:bytesize) ? MAGIC.bytesize : MAGIC.size
2425
SYNC_SIZE = 16
2526
SYNC_INTERVAL = 4000 * SYNC_SIZE
2627
META_SCHEMA = Schema.parse('{"type": "map", "values": "bytes"}')
@@ -182,7 +183,7 @@ def write_block
182183
# write number of items in block and block size in bytes
183184
encoder.write_long(block_count)
184185
to_write = codec.compress(buffer_writer.string)
185-
encoder.write_long(to_write.bytesize)
186+
encoder.write_long(to_write.respond_to?(:bytesize) ? to_write.bytesize : to_write.size)
186187

187188
# write block contents
188189
writer.write(to_write)

lang/ruby/lib/avro/io.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def read_string
9797
# A string is encoded as a long followed by that many bytes of
9898
# UTF-8 encoded character data.
9999
read_bytes.tap do |string|
100-
string.force_encoding("UTF-8")
100+
string.force_encoding("UTF-8") if string.respond_to? :force_encoding
101101
end
102102
end
103103

0 commit comments

Comments
 (0)