Sha256: edb2fbd586c5842cba2ce5ad8b5d9a1bb1a32ca5cbf33de76335930471acac23

Contents?: true

Size: 939 Bytes

Versions: 6

Compression:

Stored size: 939 Bytes

Contents

package org.jruby.ext.win32ole;

import org.racob.com.InvocationProxy;
import org.racob.com.Variant;
import org.jruby.Ruby;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

/**
 */
public class RubyInvocationProxy extends InvocationProxy {
    private final Ruby runtime;
    private final IRubyObject target;
    
    public RubyInvocationProxy(IRubyObject target) {
        this.target = target;
        this.runtime = target.getRuntime();
    }

    @Override
    public Variant invoke(String methodName, Variant[] variantArgs) {
        ThreadContext context = runtime.getCurrentContext();

        int length = variantArgs.length;
        IRubyObject[] args = new IRubyObject[length];
        for (int i = 0; i < length; i++) {
            args[i] = RubyWIN32OLE.fromVariant(runtime, variantArgs[i]);
        }

        target.callMethod(context, methodName, args);
        return null;
    }

}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jruby-win32ole-0.8.5 src/org/jruby/ext/win32ole/RubyInvocationProxy.java
jruby-win32ole-0.8.4 src/org/jruby/ext/win32ole/RubyInvocationProxy.java
jruby-win32ole-0.8.3 src/org/jruby/ext/win32ole/RubyInvocationProxy.java
jruby-win32ole-0.8.2 src/org/jruby/ext/win32ole/RubyInvocationProxy.java
jruby-win32ole-0.8.1 src/org/jruby/ext/win32ole/RubyInvocationProxy.java
jruby-win32ole-0.8.0 src/org/jruby/ext/win32ole/RubyInvocationProxy.java