Module: Dramatis

Included in:
Runtime::Task::Continuation::Future, Runtime::Task::Continuation::None, Runtime::Task::Continuation::Proc, Runtime::Task::Continuation::RPC
Defined in:
lib/dramatis.rb,
lib/dramatis.rb,
lib/dramatis/actor.rb,
lib/dramatis/error.rb,
lib/dramatis/shoes.rb,
lib/dramatis/future.rb,
lib/dramatis/runtime.rb,
lib/dramatis/version.rb,
lib/dramatis/deadlock.rb,
lib/dramatis/actor/name.rb,
lib/dramatis/runtime/gate.rb,
lib/dramatis/runtime/task.rb,
lib/dramatis/runtime/actor.rb,
lib/dramatis/runtime/timer.rb,
lib/dramatis/shoes/runtime.rb,
lib/dramatis/error/uncaught.rb,
lib/dramatis/actor/interface.rb,
lib/dramatis/future/interface.rb,
lib/dramatis/runtime/scheduler.rb,
lib/dramatis/runtime/actor/main.rb,
lib/dramatis/runtime/thread_pool.rb,
lib/dramatis/actor/name/interface.rb

Overview

The Dramatis module provides methods to manipulate dramatis objects by client code. Each function can be accessed as a module function, e.g.,

Dramatis.interface(...)

or by including the Dramatis module and using as an instance method, .e.,g

include Dramatis
interface(...)

Defined Under Namespace

Modules: Actor, Shoes, VERSION Classes: Deadlock, Error, Future, Runtime

Class Method Summary collapse

Class Method Details

.future(name) ⇒ Object

:call-seq:

future(name) -> a_name

Takes an actor name and returns a new actor name which, when used as the target of a method call, will pass a future continuation. It immediately returns a Dramatis::Future object.



67
68
69
# File 'lib/dramatis.rb', line 67

def future name
  interface( name ).future
end

.interface(object, *args, &block) ⇒ Object

:call-seq:

interface(object, *args, &block) -> an_interface

Takes a dramatis proxy object and returns an object that can be used to operate directly on the proxy, rather than on the proxied object. Since dramatis objects like actor names and futures are proxy objects, normal method calls on them are directed to the proxied object. In order to perform operations on the proxies themselves, the interface method is used to get access to a non-proxy object. If the object passed is a Dramatis::Actor::Name, the result is a Dramatis::Actor::Name::Interface object. If the object passed is a Dramatis::Future, the result is a Dramatis::Future::Interface object.



34
35
36
37
38
39
40
41
42
# File 'lib/dramatis.rb', line 34

def interface object, *args, &block 
  interface = nil    
  begin
    interface = object.class.const_get( :Interface )
  rescue NameError => name_error
    raise Dramatis::Error::Interface.new(  "object is not a dramatis interfaceable object: " + object.class.to_s )
  end
  interface.new( object, *args, &block )
end

.release(name) ⇒ Object

:call-seq:

release(name) -> a_name

Takes an actor name and returns a new actor name which, when used as the target of a method call, will pass a null continuation. As a result, the call will not block or otherwise wait for a result. The result of such a call is always nil.



54
55
56
# File 'lib/dramatis.rb', line 54

def release name
  interface( name ).continue nil
end