I am using Ruby 1.8. Using the WIN32OLE Module -
1) How to determine the class name of an instance of an OLE object? 2) How to determine if an instance of an object supports a particular method?
In an Outlook automation script, I try to delete items in the Deleted Items folder that is older than 21 days. For mail items, I want to use the ReceivedTime property, but for this I need to check if the item is really an instance of MailItem.
Secondly, the best I could come up with (very slow):
def MethodExists(obj, methodName) obj.ole_methods.each{|method| if (method.name == methodName) return true end } return false end
source share