Parent

Included Modules

Files

Caricature::ClrInterfaceIsolator

An Isolator for CLR interfaces. this implements all the methods that are defined on the interface.

Public Class Methods

new(context) click to toggle source

Implementation of the template method that creates an isolator for an interface defined in a CLR language.

    # File lib/caricature/clr/isolator.rb, line 80
80:     def initialize(context)
81:       super
82:       sklass = context.subject
83:       @descriptor = ClrInterfaceDescriptor.new sklass
84:       build_isolation sklass
85:     end

Public Instance Methods

create_isolation_for(subj) click to toggle source

builds the actual isolator for the CLR interface

     # File lib/caricature/clr/isolator.rb, line 93
 93:     def create_isolation_for(subj)
 94:       proxy_members = @descriptor.instance_members
 95: 
 96:       klass = Object.const_set(class_name(subj), Class.new)
 97:       klass.class_eval do
 98: 
 99:         include subj
100:         include Interception
101: 
102:         proxy_members.each do |mem|
103:           nm = mem.name.to_s.to_sym
104:           define_method nm do |*args|
105:             b = nil
106:             b = Proc.new { yield } if block_given?
107:             isolation_context.send_message(nm, mem.return_type, *args, &b)
108:           end
109:         end
110: 
111:       end
112: 
113:       klass
114:     end
initialize_messenger() click to toggle source

initializes the messaging strategy for the isolator

    # File lib/caricature/clr/isolator.rb, line 88
88:     def initialize_messenger
89:       @context.messenger = ClrInterfaceMessenger.new @context.expectations
90:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.