lib/rubysl/stringio/stringio.rb in rubysl-stringio-1.0.0 vs lib/rubysl/stringio/stringio.rb in rubysl-stringio-1.0.1
- old
+ new
@@ -157,14 +157,14 @@
string = d.string
if @append || pos == string.length
string << str
d.pos = string.length
- elsif pos > string.bytesize
- string[string.bytesize..pos] = "\000" * (pos - string.bytesize)
+ elsif pos > string.size
+ string[string.size..pos] = "\000" * (pos - string.size)
string << str
- d.pos = string.bytesize
+ d.pos = string.size
else
string[pos, str.length] = str
d.pos += str.length
string.taint if str.tainted?
end
@@ -200,11 +200,11 @@
!@writable
end
def eof?
d = @__data__
- d.pos >= d.string.bytesize
+ d.pos >= d.string.size
end
alias_method :eof, :eof?
def fcntl
raise NotImplementedError, "StringIO#fcntl is not implemented"
@@ -449,11 +449,11 @@
return 0
end
def size
- @__data__.string.bytesize
+ @__data__.string.size
end
alias_method :length, :size
def string
@__data__.string
@@ -505,11 +505,11 @@
pos = d.pos
string = d.string
char = Rubinius::Type.coerce_to char, Integer, :to_int
- if pos > string.bytesize
- string[string.bytesize..pos] = "\000" * (pos - string.bytesize)
+ if pos > string.size
+ string[string.size..pos] = "\000" * (pos - string.size)
d.pos -= 1
string[d.pos] = char
elsif pos > 0
d.pos -= 1
string[d.pos] = char