From: Chris Morris on 7 Apr 2010 20:35 [Note: parts of this message were removed to make it a legal post.] I have a 3rd party COM library, and this works in VBScript: Set foo = CreateObject("Foo") foo.Fields("FieldA") = 5 foo.Fields("FieldB") = "bar" WScript.Echo foo.Fields("FieldA") WScript.Echo foo.Fields("FieldB") but I can't get the assignments to work in ruby: foo = WIN32OLE.new("Foo") foo.Fields("FieldA") = 5 it errors out on this, because the evaluation up until the assignment of results in a Fixnum instance that has no "=" method or somesuch. I suspect there's a way to workaround this with something like the _setproperty method but I couldn't wrap my brain around it today. Anyone have a hint? Or is this a weird edge case in the land of COM that win32ole can't work with? -- Chris http://improvingenterprises.com http://clabs.org
From: Mitchell Hashimoto on 7 Apr 2010 21:00 Chris, To set properties with win32ole, use the property syntax, rather than accessing the property via method: foo["FieldA"] = 5 Mitchell Hashimoto -- Posted via http://www.ruby-forum.com/.
|
Pages: 1 Prev: Is it possible, a fully general Enumerable#recursive ? Next: Hash name increment on iteration? |