Class: ActionDispatch::Response::Buffer

Inherits:
Object
  • Object
show all
Defined in:
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.



69
70
71
72
73
# File 'lib/action_dispatch/http/response.rb', line 69

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

Instance Method Details

#closeObject



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

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

#closed?Boolean

Returns:

  • (Boolean)


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

def closed?
  @closed
end

#each(&block) ⇒ Object



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

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

#write(string) ⇒ Object

Raises:

  • (IOError)


75
76
77
78
79
80
# File 'lib/action_dispatch/http/response.rb', line 75

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

  @response.commit!
  @buf.push string
end