RUBY-240 minor fix for RUBY 1.8
This commit is contained in:
parent
1f6901be06
commit
6b9eef0d1f
@ -174,7 +174,7 @@ module Mongo
|
|||||||
#
|
#
|
||||||
# @return [Integer] the position of the file after rewinding (always zero).
|
# @return [Integer] the position of the file after rewinding (always zero).
|
||||||
def rewind
|
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)
|
seek(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ module Mongo
|
|||||||
#
|
#
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
def eof
|
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
|
@file_position >= @file_length
|
||||||
end
|
end
|
||||||
alias :eof? :eof
|
alias :eof? :eof
|
||||||
@ -211,7 +211,7 @@ module Mongo
|
|||||||
len = 0
|
len = 0
|
||||||
match_idx = 0
|
match_idx = 0
|
||||||
match_num = separator.length - 1
|
match_num = separator.length - 1
|
||||||
to_match = separator[match_idx]
|
to_match = separator[match_idx].chr
|
||||||
if length
|
if length
|
||||||
matcher = lambda {|idx, num| idx < num && len < length }
|
matcher = lambda {|idx, num| idx < num && len < length }
|
||||||
else
|
else
|
||||||
@ -223,12 +223,12 @@ module Mongo
|
|||||||
if char == to_match
|
if char == to_match
|
||||||
while match_idx < match_num do
|
while match_idx < match_num do
|
||||||
match_idx += 1
|
match_idx += 1
|
||||||
to_match = separator[match_idx]
|
to_match = separator[match_idx].chr
|
||||||
char = getc
|
char = getc
|
||||||
result << char
|
result << char
|
||||||
if char != to_match
|
if char != to_match
|
||||||
match_idx = 0
|
match_idx = 0
|
||||||
to_match = separator[match_idx]
|
to_match = separator[match_idx].chr
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user