== win32ole-pp

* Author: MIYAMUKO Katsuyuki <mailto:[email protected]>
* Home URL: http://win32ole-pp.rubyforge.org
* Project URL: http://rubyforge.org/projects/win32ole-pp

=== DESCRIPTION:

win32ole-pp provides smart #to_s and pretty printer for WIN32OLE object.

This library helps to develop/debug WIN32OLE applications.

=== FEATURES:

* add WIN32OLE#pretty_print method for pp.
* override WIN32OLE#to_s.

=== SYNOPSIS:

require "pp"
require "win32ole"

require "rubygems"
require "win32ole_pp"

ie = WIN32OLE.new('InternetExplorer.Application')

puts ie #=> #<WIN32OLE:0x2962380: IWebBrowser2>

pp ie #=> #<WIN32OLE:0x2962380: IWebBrowser2
# AddressBar=true,
# Application=#<WIN32OLE:0x296150c: IWebBrowser2>,
# Busy=false,
# Container=nil,
# FullName="C:\\Program Files\\Internet Explorer\\iexplore.exe",
# FullScreen=false,
# HWND=19923710,
# Height=903,
# Left=0,
# LocationName="",
# LocationURL="",
# MenuBar=true,
# Name="Microsoft Internet Explorer",
# Offline=false,
# Parent=#<WIN32OLE:0x29610ac: IWebBrowser2>,
# Path="C:\\Program Files\\Internet Explorer\\",
# ReadyState=0,
# RegisterAsBrowser=false,
# RegisterAsDropTarget=true,
# Resizable=false,
# Silent=false,
# StatusBar=true,
# StatusText="",
# TheaterMode=false,
# ToolBar=1,
# Top=0,
# TopLevelContainer=true,
# Visible=false,
# Width=1096>


nav = ie.ole_method("Navigate")

puts nav #=> #<WIN32OLE_METHOD:0x295b3dc: VOID Navigate([in] BSTR URL,
# [in, optional] VARIANT Flags, [in, optional] VARIANT TargetFrameName,
# [in, optional] VARIANT PostData, [in, optional] VARIANT Headers)>

pp nav #=> #<WIN32OLE_METHOD:0x295b3dc: Navigate
# name="Navigate",
# dispid=104,
# helpstring="Navigates to a URL or file.",
# helpcontext=0,
# helpfile="",
# invoke_kind="FUNC",
# invkind=1,
# return_type="VOID",
# return_type_detail=["VOID"],
# return_vtype=24,
# size_opt_params=4,
# size_params=5,
# offset_vtbl=44,
# visible?=true,
# event?=false,
# event_interface=nil,
# params=
# [#<WIN32OLE_PARAM:0x295a66c: URL
# name="URL",
# ole_type="BSTR",
# ole_type_detail=["BSTR"],
# default=nil,
# input?=true,
# output?=false,
# optional?=false,
# retval?=false>,
# #<WIN32OLE_PARAM:0x295a644: Flags
# name="Flags",
# <snip>


ie.Navigate("http://www.ruby-lang.org/")
sleep(1) while ie.ReadyState !=4

news = ie.document.getElementById("news")
puts news #=> #<WIN32OLE:0x29286d0: DispHTMLDivElement>

pp news #=> #<WIN32OLE:0x29286d0: DispHTMLDivElement
# accessKey="",
# align="",
# all=#<WIN32OLE:0x29a7bc4: DispHTMLElementCollection>,
# attributes=#<WIN32OLE:0x29a7b88: DispHTMLAttributeCollection>,
# behaviorUrns=#<WIN32OLE:0x29a7b4c: IHTMLUrnCollection>,
# canHaveChildren=true,
# canHaveHTML=true,
# childNodes=#<WIN32OLE:0x29a7ac0: DispDOMChildrenCollection>,
# children=#<WIN32OLE:0x29a7a84: DispHTMLElementCollection>,
# <snip>

ul = news.getElementsByTagName("ul").Item(0)
ul.childNodes.each do |e|
puts e.innerText
end


=== REQUIREMENTS:

* pp (standard library)
* win32ole (standard library)

=== INSTALL:

gem install win32ole-pp

=== LICENSE:

win32ole-pp is released under the MIT license.

Copyright (c) 2007 MIYAMUKO Katsuyuki.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.