From: Masaki Suketa Date: 2006-03-29T23:35:27+09:00 Subject: Re: WIN32OLE#[] and WIN32OLE#[]= method in Ruby 1.9 (or later) Hello, In message "Re: WIN32OLE#[] and WIN32OLE#[]= method in Ruby 1.9 (or later)" on 06/03/27, "Dave Burt" writes: > It's not ideal, but WIN32OLE doesn't use Symbols - VBScript and JScript > don't have them. > We're trying to match this VBScript, right? > > record.StringData(1) = "dddd" Yes. > As far as I understand, we can't make record.StringData(1) = "dddd" or > record.StringData[1] = "dddd" work while keeping the same dynamic call > functionality we already have (StringData should be called as a method in > both cases) but what about another option: I commited the new feature, and I uses the trick (thanks to your hint). And record.StringData[1] = "dddd" works. But the trick may create another trouble... I am not sure. So, if the trick does not work fine in another situation, then I think about using your following suggestion. > record.StringData{1} = "dddd" > > The rule would be similar to the above, but instead of looking for a symbol, > you're looking for block_given? and using "yield" as the index/parameter to > the property. > Although, in a sense, this matches semantic-for-semantic less than the > [:StringData] version, and that's what I like best about the change you're > suggesting - use Ruby's index operators for the same purpose in OLE. Thanks your great idea! Regards, Masaki Suketa