Isolator
An Isolator for CLR interfaces. this implements all the methods that are defined on the interface.
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
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
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.