jruby-win32ole 0.8.4 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/bin/sample +0 -0
- data/lib/jruby-win32ole/version.rb +1 -1
- data/lib/racob-x64.dll +0 -0
- data/lib/racob-x86.dll +0 -0
- data/lib/racob.jar +0 -0
- data/lib/win32ole/win32ole.jar +0 -0
- data/src/org/jruby/ext/win32ole/RubyWIN32OLE.java +21 -25
- metadata +6 -6
data/.gitignore
CHANGED
data/bin/sample
CHANGED
File without changes
|
data/lib/racob-x64.dll
CHANGED
Binary file
|
data/lib/racob-x86.dll
CHANGED
Binary file
|
data/lib/racob.jar
CHANGED
Binary file
|
data/lib/win32ole/win32ole.jar
CHANGED
Binary file
|
@@ -1,5 +1,6 @@
|
|
1
1
|
package org.jruby.ext.win32ole;
|
2
2
|
|
3
|
+
import java.lang.reflect.Array;
|
3
4
|
import org.racob.com.Dispatch;
|
4
5
|
import org.racob.com.EnumVariant;
|
5
6
|
import org.racob.com.Variant;
|
@@ -122,7 +123,7 @@ public class RubyWIN32OLE extends RubyObject {
|
|
122
123
|
@JRubyMethod(name = "[]", required = 1)
|
123
124
|
public IRubyObject op_aref(ThreadContext context, IRubyObject property) {
|
124
125
|
String propertyName = property.asJavaString();
|
125
|
-
|
126
|
+
|
126
127
|
return fromVariant(context.getRuntime(), dispatch.get(propertyName));
|
127
128
|
}
|
128
129
|
|
@@ -200,8 +201,10 @@ public class RubyWIN32OLE extends RubyObject {
|
|
200
201
|
if (args.length == 1) { // No-arg call
|
201
202
|
return fromObject(context.getRuntime(), dispatch.callO(methodName));
|
202
203
|
}
|
203
|
-
|
204
|
-
|
204
|
+
|
205
|
+
Variant variant = dispatch.callN(methodName, makeObjectArgs(args, 1));
|
206
|
+
return fromVariant(context.getRuntime(), variant);
|
207
|
+
|
205
208
|
}
|
206
209
|
|
207
210
|
@Override
|
@@ -209,7 +212,12 @@ public class RubyWIN32OLE extends RubyObject {
|
|
209
212
|
return dispatch;
|
210
213
|
}
|
211
214
|
|
215
|
+
private static final Class OBJECT_ARRAY_CLASS = Array.newInstance(Object.class, 1).getClass();
|
216
|
+
|
212
217
|
public static Object toObject(IRubyObject rubyObject) {
|
218
|
+
if (rubyObject instanceof RubyArray) {
|
219
|
+
return ((RubyArray) rubyObject).toJava(OBJECT_ARRAY_CLASS);
|
220
|
+
}
|
213
221
|
return rubyObject.toJava(Object.class);
|
214
222
|
}
|
215
223
|
|
@@ -239,33 +247,21 @@ public class RubyWIN32OLE extends RubyObject {
|
|
239
247
|
return JavaUtil.convertJavaToUsableRubyObject(runtime, object);
|
240
248
|
}
|
241
249
|
|
242
|
-
private static IRubyObject listFromSafeArray(Ruby runtime, SafeArray
|
243
|
-
|
244
|
-
|
245
|
-
for (int i = 0; i < list.size(); i++) {
|
246
|
-
Object element = list.get(i);
|
247
|
-
IRubyObject convertedElement = null;
|
248
|
-
|
249
|
-
if (element instanceof SafeArray) {
|
250
|
-
convertedElement = null; //TODO: Borked
|
251
|
-
} else if (element instanceof Variant) {
|
252
|
-
convertedElement = fromVariant(runtime, (Variant) element);
|
253
|
-
} else {
|
254
|
-
throw runtime.newArgumentError("Unknown element found in SafeArray: " +
|
255
|
-
element.getClass());
|
256
|
-
}
|
257
|
-
newArray.append(convertedElement);
|
258
|
-
}
|
250
|
+
private static IRubyObject listFromSafeArray(Ruby runtime, SafeArray array) {
|
251
|
+
Variant[] values = array.getValues();
|
252
|
+
RubyArray newArray = runtime.newArray();
|
259
253
|
|
260
|
-
|
254
|
+
if (values != null) {
|
255
|
+
for (int i = 0; i < values.length; i++) {
|
256
|
+
newArray.append(fromVariant(runtime, values[i]));
|
257
|
+
}
|
258
|
+
}
|
259
|
+
return newArray;
|
261
260
|
}
|
262
261
|
|
263
262
|
public static IRubyObject fromVariant(Ruby runtime, Variant variant) {
|
264
263
|
if (variant == null) return runtime.getNil();
|
265
|
-
|
266
|
-
if (variant.isArray()) {
|
267
|
-
return listFromSafeArray(runtime, (SafeArray) variant.getArray());
|
268
|
-
}
|
264
|
+
if (variant.isArray()) return listFromSafeArray(runtime, variant.getSafeArray());
|
269
265
|
|
270
266
|
switch (variant.getType()) {
|
271
267
|
case Variant.VariantBoolean:
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby-win32ole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 53
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 5
|
10
|
+
version: 0.8.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Thomas E. Enebo
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-08-21 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements: []
|
107
107
|
|
108
108
|
rubyforge_project: jruby-win32ole
|
109
|
-
rubygems_version: 1.
|
109
|
+
rubygems_version: 1.3.7
|
110
110
|
signing_key:
|
111
111
|
specification_version: 3
|
112
112
|
summary: A Gem for win32ole support on JRuby
|