Class: Opbeat::BodyProxy
- Inherits:
-
Object
show all
- Defined in:
- lib/opbeat/middleware.rb
Instance Method Summary
collapse
Constructor Details
#initialize(body, &block) ⇒ BodyProxy
Returns a new instance of BodyProxy.
31
32
33
|
# File 'lib/opbeat/middleware.rb', line 31
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
55
56
57
|
# File 'lib/opbeat/middleware.rb', line 55
def method_missing *args, &block
@body.__send__(*args, &block)
end
|
Instance Method Details
#close ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/opbeat/middleware.rb', line 39
def close
return if closed?
@closed = true
begin
@body.close if @body.respond_to?(:close)
ensure
@block.call
end
end
|
#closed? ⇒ Boolean
51
52
53
|
# File 'lib/opbeat/middleware.rb', line 51
def closed?
@closed
end
|
#respond_to?(*args) ⇒ Boolean
35
36
37
|
# File 'lib/opbeat/middleware.rb', line 35
def respond_to? *args
super || @body.respond_to?(*args)
end
|