301件ヒット
[201-300件を表示]
(0.018秒)
クラス
- Array (4)
- File (12)
- Range (12)
- Struct (24)
- Thread (12)
- WIN32OLE (24)
-
WIN32OLE
_ TYPE (12) -
WIN32OLE
_ VARIABLE (12)
モジュール
- Kernel (12)
-
Net
:: HTTPHeader (36)
キーワード
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) - Parser (12)
-
WIN32OLE
_ VARIABLE (12) - [] (12)
-
_ getproperty (12) -
_ setproperty (12) - each (36)
-
each
_ header (12) -
each
_ value (12) - flock (12)
-
net
/ http (12) -
net
/ imap (12) - new (12)
-
rb
_ protect (12) - rss (12)
-
ruby 1
. 8 . 3 feature (12) -
ruby 1
. 8 . 4 feature (12) - throw (12)
-
to
_ csv (4) - variables (12)
- クラス/メソッドの定義 (12)
- パターンマッチ (12)
検索結果
先頭5件
-
Net
:: HTTPHeader # each _ header {|name , val| . . . . } -> () (18.0) -
保持しているヘッダ名とその値をそれぞれ ブロックに渡して呼びだします。
...mlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.each_header { |key,value| puts "#{key} = #{value}" }
# => accept-encoding = gzip;q=1.0,deflate;q=0.6,identity;q=0.3
# => accept = */*
# => user-agent = Ruby
//}... -
Psych
:: Parser (18.0) -
YAML のパーサ。
...に含まれているスカラー値を表示します。
# Handler for detecting scalar values
class ScalarHandler < Psych::Handler
def scalar value, anchor, tag, plain, quoted, style
puts value
end
end
parser = Psych::Parser.new(ScalarHandler.new)
parser.parse(yaml_docume... -
WIN32OLE
# _ getproperty(dispid , args , types) -> object (18.0) -
DISPIDとパラメータの型を指定してオブジェクトのプロパティを参照します。
...')
puts excel._getproperty(558, [], []) # VisibleプロパティのDISPIDは558
workbook = excel.Workbooks.Add
sheet = workbook.Worksheets[1]
sheet._setproperty(DISPID_CELLS, [1, 2, 'hello'], [VT_I2, VT_I2, VT_BSTR])
puts sheet._getproperty(DISPID_CELLS, [1, 2], [VT_I2, VT_I2]).value... -
WIN32OLE
# _ setproperty(dispid , args , types) -> () (18.0) -
DISPIDとパラメータの型を指定してオブジェクトのプロパティを設定します。
...pplication')
puts excel._setproperty(558, # VisibleプロパティのDISPIDは558
[true], [VT_BOOL])
workbook = excel.Workbooks.Add
sheet = workbook.Worksheets[1]
sheet._setproperty(DISPID_CELLS, [1, 2, 'hello'], [VT_I2, VT_I2, VT_BSTR])
puts sheet._getp......roperty(DISPID_CELLS, [1, 2], [VT_I2, VT_I2]).value #=> 'hello'
workbook.Close(:SaveChanges => false)
excel.Quit
DISPIDはWIN32OLE_METHOD#dispidから取得できます。
@see WIN32OLE::VARIANT... -
Thread
# [](name) -> object | nil (12.0) -
name に対応したスレッドに固有のデータを取り出します。 name に対応するスレッド固有データがなければ nil を返し ます。
...read.current["name"] = "A" },
Thread.new { Thread.current[:name] = "B" },
Thread.new { Thread.current["name"] = "C" }
].each do |th|
th.join
puts "#{th.inspect}: #{th[:name]}"
end
# => #<Thread:0x00000002a54220 dead>: A
# => #<Thread:0x00000002a541a8 dead>: B
# => #<Thread:0x00000002a54130......数を返す事に注意してください。
//emlist[][ruby]{
def meth(newvalue)
begin
oldvalue = Thread.current[:name]
Thread.current[:name] = newvalue
yield
ensure
Thread.current[:name] = oldvalue
end
end
//}
この関数に与えるブロックがFiberを切り替える......new {
meth(1) {
Fiber.yield
}
}
meth(2) {
f.resume
}
f.resume
p Thread.current[:name]
# => nil if fiber-local
# => 2 if thread-local (The value 2 is leaked to outside of meth method.)
//}
Fiber を切り替えても同じ変数を返したい場合は
Thread#thread_variable_get と Thread... -
WIN32OLE
_ TYPE # variables -> [WIN32OLE _ VARIABLE] (12.0) -
型が持つ変数を取得します。
...す。
tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'XlSheetType')
vars = tobj.variables
vars.each do |v|
puts "#{v.name} = #{v.value}"
end
上記を実行すると以下の出力が得られます。
xlChart = -4109
xlDialogSheet = -4116
xlExcel... -
WIN32OLE
_ VARIABLE (12.0) -
OLEオートメーションの変数情報をRubyで参照するためのクラスです。
...OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
puts "#{variable.name}=#{variable.value}"
end
実行結果は以下となります。
xlChart=-4109
xlDialogSheet=-4116
xlExcel4IntlMacroSheet=4
xlExcel4Macr... -
net
/ imap (12.0) -
このライブラリは Internet Message Access Protocol (IMAP) の クライアントライブラリです。2060 を元に 実装されています。
...ord')
imap.examine('INBOX')
imap.search(["RECENT"]).each do |message_id|
envelope = imap.fetch(message_id, "ENVELOPE")[0].attr["ENVELOPE"]
puts "#{envelope.from[0].name}: \t#{envelope.subject}"
end
2003年4月のメールをすべて Mail/sent-mail から "Mail/sent-apr03" へ移動......("inbox")
fetch_thread = Thread.start { imap.fetch(1..-1, "UID") }
search_result = imap.search(["BODY", "hello"])
fetch_result = fetch_thread.value
imap.disconnect
とすると FETCH コマンドと SEARCH コマンドを並列に実行します。
=== エラーについて
IMAP サーバ... -
Struct
# each -> Enumerator (7.0) -
構造体の各メンバに対して繰り返します。
...ct.new は Struct の下位クラスを作成する点に
注意してください。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
joe.each {|x| puts(x) }
# => Joe Smith
# 123 Maple, Anytown NC
# 12345
//}...