mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Add ruby IOBuffer for JRuby
This commit is contained in:
parent
ab8dbfeb96
commit
48593aeb2b
2 changed files with 37 additions and 0 deletions
33
lib/puma/io_buffer.rb
Normal file
33
lib/puma/io_buffer.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
module Puma
|
||||
class IOBuffer
|
||||
def initialize
|
||||
@buf = ""
|
||||
end
|
||||
|
||||
def reset
|
||||
@buf = ""
|
||||
end
|
||||
|
||||
def <<(str)
|
||||
@buf << str
|
||||
end
|
||||
|
||||
def append(*strs)
|
||||
strs.each { |s| @buf << s }
|
||||
end
|
||||
|
||||
def to_s
|
||||
@buf
|
||||
end
|
||||
|
||||
alias_method :to_str, :to_s
|
||||
|
||||
def used
|
||||
@buf.size
|
||||
end
|
||||
|
||||
def capacity
|
||||
@buf.size
|
||||
end
|
||||
end
|
||||
end
|
|
@ -14,6 +14,10 @@ require 'puma/accept_nonblock'
|
|||
|
||||
require 'puma/puma_http11'
|
||||
|
||||
unless Puma.const_defined? "IOBuffer"
|
||||
require 'puma/io_buffer'
|
||||
end
|
||||
|
||||
require 'socket'
|
||||
|
||||
module Puma
|
||||
|
|
Loading…
Reference in a new issue