Parent

Included Modules

Caricature::ClrIsolator

A proxy to CLR objects that records method calls. this implements all the public instance methods of the class when you use it in ruby code When you use it in a CLR class you’re bound to CLR rules and it only overrides the methods that are marked as virtual. We also can’t isolate static or sealed types at the moment.

Public Class Methods

new(context) click to toggle source

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

# File lib/caricature/clr/isolator.rb, line 12
    def initialize(context)
      super
      instance = nil
      sklass = context.subject
      unless context.subject.respond_to?(:class_eval)
        sklass = context.subject.class
        instance = context.subject
      end
      @descriptor = ClrClassDescriptor.new sklass
      build_isolation sklass, (instance || sklass.new)
    end

Public Instance Methods

___super___() click to toggle source

access to the proxied subject

# File lib/caricature/clr/isolator.rb, line 40
        def ___super___
          isolation_context.instance
        end
create_isolation_for(subj) click to toggle source

builds the Isolator class for the specified subject

# File lib/caricature/clr/isolator.rb, line 30
    def  create_isolation_for(subj)
      members = @descriptor.instance_members
      class_members = @descriptor.class_members

      klass = Object.const_set(class_name(subj), Class.new(subj))
      klass.class_eval do

        include Interception

        # access to the proxied subject
        def ___super___
          isolation_context.instance
        end

        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 unless nm == :to_string
        end

        class_members.each do |mn|
          mn = mn.name.to_s.to_sym
          define_cmethod mn do |*args|
            b = nil
            b = Proc.new { yield } if block_given?
            isolation_context.send_message(mn, nil, *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 25
    def initialize_messenger
      @context.messenger = ClrClassMessenger.new @context.expectations, @subject
    end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.