Hi Thomas,


Thank you very much for the detailed explanation.

It is my understanding from your reply that I should look for 
ole_get_methods for the methods of "getter" and look for ole_put_methods 
for methods of "setter".

Question 1: In the following scripts both getters and setters have 
method "Voice" but respond_to?() responses to both of them as "fasle". 
It seems to me that respond_to?() cannot detect the methods in either 
getters or setters. Is it true? If this is case what methods can be 
detected by  respond_to?() ?


Question 2: There are ole_put_methods, ole_get_methods, and ole_methods 
in WIN32OLE. From your post now I know  the differences among 
ole_put_methods and ole_get_methods. But how about ole_methods? I only 
know it will return more methods. And most of them cannot detected by 
respond_to?(),either.


Li



C:\Users\Alex>irb
irb(main):001:0> require 'win32ole'
=> true
irb(main):002:0>
irb(main):003:0* voice=WIN32OLE.new('SAPI.SpVoice')
=> #<WIN32OLE:0x280e934>
irb(main):004:0>
irb(main):005:0* puts "1-getters"
1-getters
=> nil
irb(main):006:0> puts

=> nil
irb(main):007:0> puts voice.ole_get_methods.sort{|x,y|x.to_s<=>y.to_s}
AlertBoundary
AllowAudioOutputFormatChangesOnNextSet
AudioOutput
AudioOutputStream
EventInterests
Priority
Rate
Status
SynchronousSpeakTimeout
Voice
Volume
=> nil
irb(main):008:0> puts

=> nil
irb(main):009:0>
irb(main):010:0* puts "2-setters="
2-setters=
=> nil
irb(main):011:0> puts

=> nil
irb(main):012:0> puts voice.ole_put_methods.sort{|x,y|x.to_s<=>y.to_s}
AlertBoundary
AllowAudioOutputFormatChangesOnNextSet
AudioOutput
AudioOutputStream
EventInterests
Priority
Rate
SynchronousSpeakTimeout
Voice
Volume
=> nil
irb(main):013:0> puts

=> nil
irb(main):014:0>
irb(main):015:0* puts "respond to 1-getters"
respond to 1-getters
=> nil
irb(main):016:0> puts voice.respond_to?("Voice")
false
=> nil
irb(main):017:0>
irb(main):018:0* puts "respond to 2-setters="
respond to 2-setters=
=> nil
irb(main):019:0> puts voice.respond_to?("Voice")
false
=> nil
irb(main):020:0>

-- 
Posted via http://www.ruby-forum.com/.