Ruby: Print WIN32OLE method names in Ruby

class WIN32OLE

def list_ole_methods

method_names = ole_methods.collect {|m| m.name}

puts method_names.sort.uniq

end

end

WIN32OLE.new('Shell.Application').list_ole_methods

得到如下方法:

AddRef

AddToRecent

Application

BrowseForFolder

CanStartStopService

CascadeWindows

ControlPanelItem

EjectPC

Explore

ExplorerPolicy

FileRun

FindComputer

FindFiles

FindPrinter

GetIDsOfNames

GetSetting

GetSystemInformation

GetTypeInfo

GetTypeInfoCount

Help

Invoke

IsRestricted

IsServiceRunning

MinimizeAll

NameSpace

Open

Parent

QueryInterface

RefreshMenu

Release

ServiceStart

ServiceStop

SetTime

ShellExecute

ShowBrowserBar

ShutdownWindows

Suspend

TileHorizontally

TileVertically

ToggleDesktop

TrayProperties

UndoMinimizeALL

WindowSwitcher

Windows

WindowsSecurity