class ActionDispatch::Response::Buffer

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/action_dispatch/http/response.rbs

class ActionDispatch::Response::Buffer
  def initialize: (ActionDispatch::Response response, (Array[] | Array[ActionView::OutputBuffer]) buf) -> void
end

:nodoc:

def abort

def abort
end

def body

def body
  @str_body ||= begin
    buf = +""
    each { |chunk| buf << chunk }
    buf
  end
end

def close

def close
  @response.commit!
  @closed = true
end

def closed?

def closed?
  @closed
end

def each(&block)

def each(&block)
  if @str_body
    return enum_for(:each) unless block_given?
    yield @str_body
  else
    each_chunk(&block)
  end
end

def each_chunk(&block)

def each_chunk(&block)
  @buf.each(&block)
end

def initialize(response, buf)

Experimental RBS support (using type sampling data from the type_fusion project).

def initialize: (ActionDispatch::Response response,  buf) -> void

This signature was generated using 5 samples from 1 application.

:nodoc:
def initialize(response, buf)
  @response = response
  @buf      = buf
  @closed   = false
  @str_body = nil
end

def write(string)

def write(string)
  raise IOError, "closed stream" if closed?
  @str_body = nil
  @response.commit!
  @buf.push string
end