2017-11-03 02:07:24 -04:00
|
|
|
begin
|
|
|
|
require 'win32ole.so'
|
|
|
|
rescue LoadError
|
|
|
|
# do nothing
|
|
|
|
end
|
|
|
|
|
|
|
|
if defined?(WIN32OLE)
|
|
|
|
# WIN32OLE
|
|
|
|
class WIN32OLE
|
|
|
|
|
|
|
|
#
|
|
|
|
# By overriding Object#methods, WIN32OLE might
|
|
|
|
# work well with did_you_mean gem.
|
2017-11-03 03:14:51 -04:00
|
|
|
# This is experimental.
|
2017-11-03 02:07:24 -04:00
|
|
|
#
|
|
|
|
# require 'win32ole'
|
|
|
|
# dict = WIN32OLE.new('Scripting.Dictionary')
|
|
|
|
# dict.Ade('a', 1)
|
|
|
|
# #=> Did you mean? Add
|
|
|
|
#
|
|
|
|
def methods(*args)
|
2018-09-26 05:33:46 -04:00
|
|
|
super + ole_methods_safely.map(&:name).map(&:to_sym)
|
2017-11-04 21:02:04 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def ole_methods_safely
|
|
|
|
ole_methods
|
|
|
|
rescue WIN32OLEQueryInterfaceError
|
|
|
|
[]
|
2017-11-03 02:07:24 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|