Skip to content

Commit 28f2901

Browse files
committed
Refactor buffer usage to only use append_as_bytes
1 parent 0d8c17a commit 28f2901

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/openssl/buffering.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def append_as_bytes(string)
3737
end
3838
end
3939

40-
alias_method :concat, :append_as_bytes
41-
alias_method :<<, :append_as_bytes
40+
undef_method :concat
41+
undef_method :<<
4242
end
4343

4444
##
@@ -73,7 +73,7 @@ def initialize(*)
7373

7474
def fill_rbuff
7575
begin
76-
@rbuffer << self.sysread(BLOCK_SIZE)
76+
@rbuffer.append_as_bytes(self.sysread(BLOCK_SIZE))
7777
rescue Errno::EAGAIN
7878
retry
7979
rescue EOFError
@@ -450,10 +450,10 @@ def <<(s)
450450
def puts(*args)
451451
s = Buffer.new
452452
if args.empty?
453-
s << "\n"
453+
s.append_as_bytes("\n")
454454
end
455455
args.each{|arg|
456-
s << arg.to_s
456+
s.append_as_bytes(arg.to_s)
457457
s.sub!(/(?<!\n)\z/, "\n")
458458
}
459459
do_write(s)
@@ -467,7 +467,7 @@ def puts(*args)
467467

468468
def print(*args)
469469
s = Buffer.new
470-
args.each{ |arg| s << arg.to_s }
470+
args.each{ |arg| s.append_as_bytes(arg.to_s) }
471471
do_write(s)
472472
nil
473473
end

test/openssl/test_buffering.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def sysread(size)
3131
end
3232

3333
def syswrite(str)
34-
@io << str
34+
@io.append_as_bytes(str)
3535
str.size
3636
end
3737
end

0 commit comments

Comments
 (0)