A proxy class to aid in deferred instantiation of service points. This is used primarily by the "deferred" service models.

Methods
Public Class methods
new( service_point, &init )

Create a new proxy that wraps the given service point.

    # File lib/copland/models/proxy.rb, line 44
44:       def initialize( service_point, &init )
45:         @service_point = service_point
46:         @mutex = Mutex.new
47:         @init = init
48:       end
Public Instance methods
inspect()
    # File lib/copland/models/proxy.rb, line 92
92:       def inspect
93:         "#<#{self.class.name}:#{"0x%08x"%self.id}:" +
94:         "service_point=>#{@service_point.full_name}:" +
95:         "instantiated=>#{@instance ? true : false}>"
96:       end
method_missing( sym, *args, &block )

Attempts to invoke the given message on the service. If the service has not yet been instantiated, it will be instantiated and stored.

    # File lib/copland/models/proxy.rb, line 52
52:       def method_missing( sym, *args, &block )
53:         unless @instance || @instantiation_failed
54:           @mutex.synchronize do
55:             unless @instance || @instantiation_failed
56:               begin
57:                 @instance = @service_point.instantiate( &@init )
58:               rescue Exception
59:                 @instantiation_failed = true
60:                 raise
61:               end
62:             end
63:           end
64:         end
65: 
66:         unless @instantiation_failed
67:           @instance.__send__ sym, *args, &block
68:         else
69:           # just return nil... this way, a failed instantiation won't barf
70:           # more than once... I hope...
71:         end
72:       end