From 6b9eef0d1f09b8c92dc0c249b7176c896a388fec Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Tue, 29 Mar 2011 16:01:46 -0400 Subject: [PATCH] RUBY-240 minor fix for RUBY 1.8 --- lib/mongo/gridfs/grid_io.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/mongo/gridfs/grid_io.rb b/lib/mongo/gridfs/grid_io.rb index d7fb464..5e86507 100644 --- a/lib/mongo/gridfs/grid_io.rb +++ b/lib/mongo/gridfs/grid_io.rb @@ -174,7 +174,7 @@ module Mongo # # @return [Integer] the position of the file after rewinding (always zero). def rewind - raise GridError, "file not opened for read" unless @mode[0] == "r" + raise GridError, "file not opened for read" unless @mode[0] == ?r seek(0) end @@ -183,7 +183,7 @@ module Mongo # # @return [Boolean] def eof - raise GridError, "file not opened for read" unless @mode[0] == "r" + raise GridError, "file not opened for read #{@mode}" unless @mode[0] == ?r @file_position >= @file_length end alias :eof? :eof @@ -211,7 +211,7 @@ module Mongo len = 0 match_idx = 0 match_num = separator.length - 1 - to_match = separator[match_idx] + to_match = separator[match_idx].chr if length matcher = lambda {|idx, num| idx < num && len < length } else @@ -223,12 +223,12 @@ module Mongo if char == to_match while match_idx < match_num do match_idx += 1 - to_match = separator[match_idx] + to_match = separator[match_idx].chr char = getc result << char if char != to_match match_idx = 0 - to_match = separator[match_idx] + to_match = separator[match_idx].chr break end end