Class: Rack::BodyProxy
- Inherits:
-
Object
show all
- Defined in:
- lib/sinatra/body_proxy.rb
Instance Method Summary
collapse
Constructor Details
#initialize(body, &block) ⇒ BodyProxy
Returns a new instance of BodyProxy.
8
9
10
|
# File 'lib/sinatra/body_proxy.rb', line 8
def initialize(body, &block)
@body, @block, @closed = body, block, false
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
30
31
32
|
# File 'lib/sinatra/body_proxy.rb', line 30
def method_missing(*args, &block)
@body.__send__(*args, &block)
end
|
Instance Method Details
#close ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/sinatra/body_proxy.rb', line 16
def close
raise IOError, "closed stream" if @closed
begin
@body.close if @body.respond_to? :close
ensure
@block.call
@closed = true
end
end
|
#closed? ⇒ Boolean
26
27
28
|
# File 'lib/sinatra/body_proxy.rb', line 26
def closed?
@closed
end
|
#respond_to?(*args) ⇒ Boolean
12
13
14
|
# File 'lib/sinatra/body_proxy.rb', line 12
def respond_to?(*args)
super or @body.respond_to?(*args)
end
|