jruby-win32ole 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module JRuby
2
2
  module WIN32OLE
3
- VERSION = "0.8.1"
3
+ VERSION = "0.8.2"
4
4
  end
5
5
  end
data/lib/racob-x64.dll CHANGED
Binary file
data/lib/racob-x86.dll CHANGED
Binary file
data/lib/racob.jar CHANGED
Binary file
Binary file
@@ -5,6 +5,7 @@ import org.racob.com.EnumVariant;
5
5
  import org.racob.com.Variant;
6
6
  import java.util.Calendar;
7
7
  import java.util.Date;
8
+ import java.util.List;
8
9
  import org.jruby.Ruby;
9
10
  import org.jruby.RubyArray;
10
11
  import org.jruby.RubyClass;
@@ -16,6 +17,7 @@ import org.jruby.runtime.Block;
16
17
  import org.jruby.runtime.ObjectAllocator;
17
18
  import org.jruby.runtime.ThreadContext;
18
19
  import org.jruby.runtime.builtin.IRubyObject;
20
+ import org.racob.com.SafeArray;
19
21
  import win32ole.Win32oleService;
20
22
 
21
23
  /**
@@ -165,6 +167,7 @@ public class RubyWIN32OLE extends RubyObject {
165
167
  Variant returnValue = Dispatch.invoke(dispatch, dispatchId, dispatchType,
166
168
  objectArgs, errorArgs);
167
169
 
170
+ System.out.println("INVOKEINTERNAL: " + returnValue);
168
171
  return fromVariant(context.getRuntime(), returnValue);
169
172
  }
170
173
  private int[] makeErrorArgs(int size) {
@@ -232,14 +235,41 @@ public class RubyWIN32OLE extends RubyObject {
232
235
  return runtime.newFixnum(((Number) object).intValue());
233
236
  } else if (object instanceof String) {
234
237
  return runtime.newString((String) object);
238
+ } else if (object instanceof SafeArray) {
239
+ return listFromSafeArray(runtime, (SafeArray) object);
235
240
  }
236
241
 
237
242
  return JavaUtil.convertJavaToUsableRubyObject(runtime, object);
238
243
  }
239
244
 
245
+ private static IRubyObject listFromSafeArray(Ruby runtime, SafeArray list) {
246
+ RubyArray newArray = runtime.newArray();
247
+
248
+ for (int i = 0; i < list.size(); i++) {
249
+ Object element = list.get(i);
250
+ IRubyObject convertedElement = null;
251
+
252
+ if (element instanceof SafeArray) {
253
+ convertedElement = null; //TODO: Borked
254
+ } else if (element instanceof Variant) {
255
+ convertedElement = fromVariant(runtime, (Variant) element);
256
+ } else {
257
+ throw runtime.newArgumentError("Unknown element found in SafeArray: " +
258
+ element.getClass());
259
+ }
260
+ newArray.append(convertedElement);
261
+ }
262
+
263
+ return newArray;
264
+ }
265
+
240
266
  public static IRubyObject fromVariant(Ruby runtime, Variant variant) {
241
267
  if (variant == null) return runtime.getNil();
242
268
 
269
+ if (variant.isArray()) {
270
+ return listFromSafeArray(runtime, (SafeArray) variant.getArray());
271
+ }
272
+
243
273
  switch (variant.getType()) {
244
274
  case Variant.VariantBoolean:
245
275
  return runtime.newBoolean(variant.getBoolean());
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 8
8
- - 1
9
- version: 0.8.1
8
+ - 2
9
+ version: 0.8.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Thomas E. Enebo
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-09 00:00:00 -06:00
17
+ date: 2010-12-19 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies: []
20
20