Parent

Included Modules

Files

Caricature::RubyIsolator

A proxy to Ruby objects that records method calls this implements all the instance methods that are defined on the class.

Public Class Methods

new(context) click to toggle source

implemented template method for creating Ruby isolations

     # File lib/caricature/isolator.rb, line 242
242:     def initialize(context)
243:       super
244:       klass = @context.subject.respond_to?(:class_eval) ? @context.subject : @context.subject.class
245:       inst = @context.subject.respond_to?(:class_eval) ? nil : @context.subject
246:       # inst = @context.subject.respond_to?(:class_eval) ? @context.subject.new : @context.subject            

247:       @descriptor = RubyObjectDescriptor.new klass
248:       build_isolation klass, inst
249:     end
new(*args) click to toggle source

(Not documented)

     # File lib/caricature/isolator.rb, line 280
280:         def initialize(*args)  
281:           self                      
282:         end

Public Instance Methods

___super___() click to toggle source

access to the proxied subject

     # File lib/caricature/isolator.rb, line 267
267:         def ___super___
268:           isolation_context.instance
269:         end
create_isolation_for(subj) click to toggle source

creates the ruby isolator for the specified subject

     # File lib/caricature/isolator.rb, line 257
257:     def create_isolation_for(subj)
258:       imembers = @descriptor.instance_members
259:       cmembers = @descriptor.class_members
260: 
261:       klass = Object.const_set(class_name(subj), Class.new(subj))
262:       klass.class_eval do
263: 
264:         include Interception
265: 
266:         # access to the proxied subject

267:         def ___super___
268:           isolation_context.instance
269:         end
270: 
271:         imembers.each do |mn|
272:           mn = mn.name.to_s.to_sym
273:           define_method mn do |*args|
274:             b = nil
275:             b = Proc.new { yield } if block_given?  
276:             isolation_context.send_message(mn, nil, *args, &b)
277:           end
278:         end  
279:         
280:         def initialize(*args)  
281:           self                      
282:         end 
283:                    
284:         cmembers.each do |mn|
285:           mn = mn.name.to_s.to_sym
286:           define_cmethod mn do |*args|        
287:             b = nil
288:             b = Proc.new { yield } if block_given?  
289:             isolation_context.send_class_message(mn, nil, *args, &b)
290:           end
291:         end   
292:               
293: 
294: 
295:       end
296: 
297:       klass
298:     end
initialize_messenger() click to toggle source

initializes the messaging strategy for the isolator

     # File lib/caricature/isolator.rb, line 252
252:     def initialize_messenger
253:       @context.messenger = RubyMessenger.new @context.expectations, @subject
254:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.