class Sequel::Database::AsyncThreadPool::BaseProxy

  1. lib/sequel/extensions/async_thread_pool.rb
Superclass: BasicObject

Base proxy object class for jobs processed by async threads and the returned result.

Methods

Public Class

  1. new

Public Instance

  1. __value
  2. method_missing
  3. respond_to_missing?

Public Class methods

new(&block)

Store a block that returns the result when called.

[show source]
    # File lib/sequel/extensions/async_thread_pool.rb
238 def initialize(&block)
239   ::Kernel.raise Error, "must provide block for an async job" unless block
240   @block = block
241 end

Public Instance methods

__value()

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.

[show source]
    # File lib/sequel/extensions/async_thread_pool.rb
267 def __value
268   unless defined?(@value)
269     __get_value
270   end
271 
272   if @value.is_a?(WrappedException)
273     ::Kernel.raise @value
274   end
275 
276   @value
277 end
method_missing(*args, &block)

Pass all method calls to the returned result.

[show source]
    # File lib/sequel/extensions/async_thread_pool.rb
244 def method_missing(*args, &block)
245   __value.public_send(*args, &block)
246 end
respond_to_missing?(*args)

Delegate respond_to? calls to the returned result.

[show source]
    # File lib/sequel/extensions/async_thread_pool.rb
252 def respond_to_missing?(*args)
253   __value.respond_to?(*args)
254 end