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 75 def initialize(context) super sklass = context.subject @descriptor = ClrInterfaceDescriptor.new sklass build_isolation sklass end
builds the actual isolator for the CLR interface
# File lib/caricature/clr/isolator.rb, line 88 def create_isolation_for(subj) proxy_members = @descriptor.instance_members klass = Object.const_set(class_name(subj), Class.new) klass.class_eval do include subj include Interception proxy_members.each do |mem| nm = mem.name.to_s.to_sym define_method nm do |*args| b = nil b = Proc.new { yield } if block_given? isolation_context.send_message(nm, mem.return_type, *args, &b) end end end klass end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.