Parent

Included Modules

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 75
    def initialize(context)
      super
      sklass = context.subject
      @descriptor = ClrInterfaceDescriptor.new sklass
      build_isolation sklass
    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 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
initialize_messenger() click to toggle source

initializes the messaging strategy for the isolator

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

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.