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.
237 238 239 |
# File 'lib/sequel/extensions/async_thread_pool.rb', line 237 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.
260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/sequel/extensions/async_thread_pool.rb', line 260 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.
245 246 247 |
# File 'lib/sequel/extensions/async_thread_pool.rb', line 245 def respond_to_missing?(*args) __value.respond_to?(*args) end |