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
231 def initialize(&block)
232   ::Kernel.raise Error, "must provide block for an async job" unless block
233   @block = block
234 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
260 def __value
261   unless defined?(@value)
262     __get_value
263   end
264 
265   if @value.is_a?(WrappedException)
266     ::Kernel.raise @value
267   end
268 
269   @value
270 end
method_missing(*args, &block)

Pass all method calls to the returned result.

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

Delegate respond_to? calls to the returned result.

[show source]
    # File lib/sequel/extensions/async_thread_pool.rb
245 def respond_to_missing?(*args)
246   __value.respond_to?(*args)
247 end