るりまサーチ

最速Rubyリファレンスマニュアル検索!
33件ヒット [1-33件を表示] (0.063秒)
トップページ > クエリ:|[x] > クエリ:-[x] > クエリ:handler=[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

キーワード

検索結果

WIN32OLE_EVENT#handler=(obj) -> () (18224.0)

イベント処理を実行するオブジェクトを登録します。

...@completed = false
end
attr_reader :completed
def onDocumentComplete(disp, uri)
disp.document.getElementsByTagName('a').each do |e|
puts "#{e.innerHTML}=#{e.href}"
end
@completed = true
end
def method_missing(id, *args)
puts "event=#{id.to_s}, a...
...end

ie = WIN32OLE.new('InternetExplorer.Application.1')
event = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents2')
event.handler = IeHandler.new
ie.Navigate2 'http://www.ruby-lang.org/ja/'
loop do
break if event.handler.completed
WIN32OLE_EVENT.message_loop
end
ie.Quit

WIN32OLE_EVE...

WIN32OLE_TYPE#default_event_sources -> [WIN32OLE_TYPE] (424.0)

型が持つソースインターフェイスを取得します。

...は空配列を返します。

tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'Worksheet')
tobj.default_event_sources.map {|intf| intf.name} #=> ["DocEvents"]

WIN32OLE_EVENT.newでインターフェイス名を指定しない場合は、ここで
返されたインターフ...
...do |m|
WebEvent.module_eval do
define_method("on#{m.name}") do |*arg|
if arg[0] == "ページが表示されました"
@completed = true
end
puts "#{Time.now}: #{m.name} was called"
p arg
end
end
end
evt = WIN32OLE_EVENT.new(ctl)
evt.handler =...
...by-lang.org/'
loop do
break if evt.handler.completed
WIN32OLE_EVENT.message_loop
end
ctl.Quit

このプログラムを実行するとWindows7のIE8環境では以下のような出力を得られ
ます。

2010-10-06 22:33:54 +0900: PropertyChange was called
["{265b75c1-4158-11d0-90f6-0...

WEBrick::HTTPProxyServer.new(config, default = WEBrick::Config::HTTP) -> WEBrick::HTTPProxyServer (130.0)

プロクシオブジェクトを生成して返します。

...::ProxyDigestAuth を使用します。
//emlist{
require 'webrick'
require 'webrick/httpproxy'
auth_proc = proc{|req, res|
unless c = req['proxy-authorization']
res['Proxy-Authenticate'] = 'Basic realm="WEBrick Proxy"'
raise WEBrick::HTTPStatus::ProxyAuthenticationRequired
else...
...l を指定した場合なにもしません。デフォルトは nil です。
//emlist{
require 'webrick'
require 'webrick/httpproxy'
handler =
proc{|req, res|
res.body.gsub!(/です。/, 'でんがな。')
res.body.gsub!(/ます。/, 'まんがな。')
}
s = WEBrick::HTTPProxyServer.ne...