Class: ActionDispatch::Response::Buffer

Inherits:
Object
  • Object
show all
Defined in:
actionpack/lib/action_dispatch/http/response.rb

Overview

:nodoc:

Direct Known Subclasses

ActionController::Live::Buffer

Instance Method Summary collapse

Constructor Details

#initialize(response, buf) ⇒ Buffer

Returns a new instance of Buffer.



79
80
81
82
83
# File 'actionpack/lib/action_dispatch/http/response.rb', line 79

def initialize(response, buf)
  @response = response
  @buf      = buf
  @closed   = false
end

Instance Method Details

#closeObject



96
97
98
99
# File 'actionpack/lib/action_dispatch/http/response.rb', line 96

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

#closed?Boolean

Returns:

  • (Boolean)


101
102
103
# File 'actionpack/lib/action_dispatch/http/response.rb', line 101

def closed?
  @closed
end

#each(&block) ⇒ Object



92
93
94
# File 'actionpack/lib/action_dispatch/http/response.rb', line 92

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

#write(string) ⇒ Object

Raises:

  • (IOError)


85
86
87
88
89
90
# File 'actionpack/lib/action_dispatch/http/response.rb', line 85

def write(string)
  raise IOError, "closed stream" if closed?

  @response.commit!
  @buf.push string
end