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.


82
83
84
85
86
# File 'actionpack/lib/action_dispatch/http/response.rb', line 82

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

Instance Method Details

#abortObject


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

def abort
end

#closeObject


105
106
107
108
# File 'actionpack/lib/action_dispatch/http/response.rb', line 105

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

#closed?Boolean

Returns:

  • (Boolean)

110
111
112
# File 'actionpack/lib/action_dispatch/http/response.rb', line 110

def closed?
  @closed
end

#each(&block) ⇒ Object


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

def each(&block)
  @response.sending!
  x = @buf.each(&block)
  @response.sent!
  x
end

#write(string) ⇒ Object

Raises:

  • (IOError)

88
89
90
91
92
93
# File 'actionpack/lib/action_dispatch/http/response.rb', line 88

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

  @response.commit!
  @buf.push string
end