Class: Sequel::Database::AsyncThreadPool::BaseProxy
- Inherits:
- BasicObject
- Defined in:
- lib/sequel/extensions/async_thread_pool.rb
Overview
Base proxy object class for jobs processed by async threads and the returned result.
Direct Known Subclasses
Instance Method Summary collapse
-
#__value ⇒ Object
Wait for the value to be loaded if it hasn’t already been loaded.
-
#initialize(&block) ⇒ BaseProxy
constructor
Store a block that returns the result when called.
-
#method_missing(*args, &block) ⇒ Object
Pass all method calls to the returned result.
-
#respond_to_missing?(*args) ⇒ Boolean
Delegate respond_to? calls to the returned result.
Methods inherited from BasicObject
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
Pass all method calls to the returned result.
244 245 246 |
# File 'lib/sequel/extensions/async_thread_pool.rb', line 244 def method_missing(*args, &block) __value.public_send(*args, &block) end |
Instance Method Details
#__value ⇒ Object
Wait for the value to be loaded if it hasn’t already been loaded. If the code to load the return value raised an exception that was wrapped, reraise the exception.
267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/sequel/extensions/async_thread_pool.rb', line 267 def __value unless defined?(@value) __get_value end if @value.is_a?(WrappedException) ::Kernel.raise @value end @value end |
#respond_to_missing?(*args) ⇒ Boolean
Delegate respond_to? calls to the returned result.
252 253 254 |
# File 'lib/sequel/extensions/async_thread_pool.rb', line 252 def respond_to_missing?(*args) __value.respond_to?(*args) end |