種類
- 文書 (24)
- ライブラリ (24)
- クラス (12)
- インスタンスメソッド (12)
クラス
- Object (12)
キーワード
-
WIN32OLE
_ TYPELIB (12) -
net
/ imap (12) -
net
/ pop (12) -
ruby 1
. 6 feature (12) - tap (12)
- パターンマッチ (12)
検索結果
-
ruby 1
. 6 feature (72.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...のソケットの問題が1つ解決されたようです。(どのような問題かは
大本のメールがわかりませんでしたが、selectで読み込み可能になったのに
空配列が返されるという問題なのだそうです) ((<ruby-talk:40015>)),
((<ruby-win32:366>)......シグナルを送らないと終了しない不具合が修正さ
れました。((<ruby-bugs-ja:PR#223>))
trap(:TERM, "EXIT")
END{
puts "exit"
}
Thread.start { Thread.stop }
sleep
: 2002-04-17: Regexp#inspect
((<ruby-bugs-ja:PR#222>))
p %r{\/}
=> ruby 1......def _ptr() Ptr.new(self) end
end
def foo(int)
int[] += 1
end
x = 1._ptr
foo(x)
puts x[]
=> -:11: [BUG] Segmentation fault
ruby 1.6.5 (2001-09-19) [i586-linux]
=> -:11:in `[]=': wrong # of arguments... -
パターンマッチ (42.0)
-
パターンマッチ * patterns * variable_binding * variable_pinning * matching_non_primitive_objects * guard_clauses * current_feature_status * pattern_syntax * some_undefined_behavior_examples
...r:} # ネストしてハッシュにマッチして、その値を変数userに代入する
puts "Connect with user '#{user}'"
in connection: {username: }
puts "Connect with user '#{username}'"
else
puts "Unrecognized structure of config"
end
# "Connect with user 'admin'" と出力
//}
一方......n', password: 'abc123'}}
config in {db: {user:}} # もし config の構造が期待したものでなかった場合には、例外が発生する
puts "Connect with user '#{user}'"
# Connect with user 'admin'" と出力
//}
『<expression> in <pattern>』 は 『<expression>; in <pattern>; true;......{id: 2, level: 'high'}]}
john = {school: 'high', schools: [{id: 1, level: 'middle'}]}
case jane
in school:, schools: [*, {id:, level: ^school}] # select the last school, level should match
"matched. school: #{id}"
else
"not matched"
end
#=> "matched. school: 2"
case john # 指定された sch......n', password: 'abc123'}}
config => {db: {user:}} # もし config の構造が期待したものでなかった場合には、例外が発生する
puts "Connect with user '#{user}'"
# Connect with user 'admin'" と出力
//}
『<expression> in <pattern>』 は 『<expression>; in <pattern>; true;... -
net
/ pop (36.0) -
このライブラリは、POP3 (Post Office Protocol version 3) を 用いてPOPサーバからメールを受信する機能を提供するライブラリです。
...始
if pop.mails.empty?
$stderr.puts 'no mail.'
else
pop.mails.each_with_index do |m, idx| # 各メッセージにアクセスする
File.open("inbox/#{idx + 1}", 'w') {|f|
f.write m.pop
}
m.delete
end
$stderr.puts "#{pop.mails.size} mails popped."
en......word') {|pop|
if pop.mails.empty?
$stderr.puts 'no mail.'
else
pop.mails.each_with_index do |m, idx|
File.open("inbox/#{idx + 1}", 'w') {|f|
f.write m.pop
}
m.delete
end
$stderr.puts "#{pop.mails.size} mails popped."
end
}
Net:......場合に真を返す
end
Net::POP3.start('pop.example.com', 110,
'Your account', 'Your password') do |pop|
pop.mails.select { |m| need_pop?(m.unique_id) }.each do |m|
do_something(m.pop)
end
end
Net::POPMail#unique_id はメッセージのユニークIDを... -
Object
# tap {|x| . . . } -> self (30.0) -
self を引数としてブロックを評価し、self を返します。
...のメソッドの主目的です。
//emlist[][ruby]{
(1..10) .tap {|x| puts "original: #{x}" }
.to_a .tap {|x| puts "array: #{x}" }
.select {|x| x.even? } .tap {|x| puts "evens: #{x}" }
.map {|x| x*x } .tap {|x| puts "squares: #{x}" }
//}......目的です。
//emlist[][ruby]{
(1..10) .tap {|x| puts "original: #{x}" }
.to_a .tap {|x| puts "array: #{x}" }
.select {|x| x.even? } .tap {|x| puts "evens: #{x}" }
.map {|x| x*x } .tap {|x| puts "squares: #{x}" }
//}
@see Object#yield_self... -
WIN32OLE
_ TYPELIB (30.0) -
OLEオートメーションサーバの型情報ライブラリ(TypeLib)を操作するための クラスです。
...LIB.new('Microsoft Excel 14.0 Object Library')
puts "Guid of Excel typelib = #{tlib.guid}"
puts "version = #{tlib.major_version}.#{tlib.minor_version}"
puts "creatable classes:"
tlib.ole_types.select{|cls| cls.progid }.each do |cls|
puts " #{cls.name}: PROGID=#{cls.progid}"
end... -
net
/ imap (30.0) -
このライブラリは Internet Message Access Protocol (IMAP) の クライアントライブラリです。2060 を元に 実装されています。
...セージ(メール)を処理する場合、
まず Net::IMAP#select もしくは
Net::IMAP#examine で処理対象のメールボックスを
指定する必要があります。これらの操作が成功したならば、
「selected」状態に移行し、そのメールボックスが「処理......対象の」
メールボックスとなります。このようにしてメールボックスを
選択してから、selected状態を終える(別のメールボックスを選択したり、
接続を終了したり)までをセッションと呼びます。
メッセージには2種類の識......]
puts "#{envelope.from[0].name}: \t#{envelope.subject}"
end
2003年4月のメールをすべて Mail/sent-mail から "Mail/sent-apr03" へ移動させる
require 'net/imap'
imap = Net::IMAP.new('mail.example.com')
imap.authenticate('LOGIN', 'joe_user', 'joes_password')
imap.select...
