Class: ActionDispatch::Response::Buffer
- Inherits:
-
Object
- Object
- ActionDispatch::Response::Buffer
show all
- Defined in:
- actionpack/lib/action_dispatch/http/response.rb
Overview
Instance Method Summary
collapse
Constructor Details
#initialize(response, buf) ⇒ Buffer
Returns a new instance of Buffer.
80
81
82
83
84
|
# File 'actionpack/lib/action_dispatch/http/response.rb', line 80
def initialize(response, buf)
@response = response
@buf = buf
@closed = false
end
|
Instance Method Details
100
101
102
103
|
# File 'actionpack/lib/action_dispatch/http/response.rb', line 100
def close
@response.commit!
@closed = true
end
|
#closed? ⇒ Boolean
105
106
107
|
# File 'actionpack/lib/action_dispatch/http/response.rb', line 105
def closed?
@closed
end
|
#each(&block) ⇒ Object
93
94
95
96
97
98
|
# File 'actionpack/lib/action_dispatch/http/response.rb', line 93
def each(&block)
@response.sending!
x = @buf.each(&block)
@response.sent!
x
end
|
#write(string) ⇒ Object
86
87
88
89
90
91
|
# File 'actionpack/lib/action_dispatch/http/response.rb', line 86
def write(string)
raise IOError, "closed stream" if closed?
@response.commit!
@buf.push string
end
|