Class: MethodDecorators::Within
- Defined in:
- lib/method_decorators/within.rb
Instance Method Summary collapse
- #call(orig, this, *args, &blk) ⇒ Object
-
#initialize(timeout) ⇒ Within
constructor
A new instance of Within.
Methods inherited from Decorator
Constructor Details
#initialize(timeout) ⇒ Within
Returns a new instance of Within.
6 7 8 |
# File 'lib/method_decorators/within.rb', line 6 def initialize(timeout) @seconds = timeout end |
Instance Method Details
#call(orig, this, *args, &blk) ⇒ Object
10 11 12 13 14 |
# File 'lib/method_decorators/within.rb', line 10 def call(orig, this, *args, &blk) Timeout::timeout(@seconds) do orig.call(*args, &blk) end end |