種類
- インスタンスメソッド (56)
- 特異メソッド (16)
- ライブラリ (11)
- 定数 (11)
- 文書 (5)
クラス
- Exception (7)
-
Net
:: IMAP (33) -
Net
:: IMAP :: StatusData (11) - Thread (32)
キーワード
-
NEWS for Ruby 2
. 7 . 0 (5) - attr (11)
-
net
/ imap (11) -
report
_ on _ exception (16) -
report
_ on _ exception= (16) - select (11)
- status (11)
検索結果
先頭5件
-
Net
:: IMAP :: RECENT -> Symbol (21117.0) -
「:Recent」というシンボルを返します。
...「:Recent」というシンボルを返します。
メッセージが「最近」メールボックスに到着したことを意味します。
フラグメッセージ属性として用いられます
(Net::IMAP::FetchData#attr)。
詳しくは 2060 を参照してください。... -
Thread
# report _ on _ exception -> bool (6106.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.report_on_exception # => true......7fc3f48c7908@(irb):1 run> terminated with exception (report_on_exception is true):
# Traceback (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_exception = false
b.r......un # => #<Thread:0x00007fc3f48aefc0@(irb):4 dead>
//}
@see Thread.report_on_exception... -
Thread
# report _ on _ exception=(newstate) (6106.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.report_on_exception # => true......7fc3f48c7908@(irb):1 run> terminated with exception (report_on_exception is true):
# Traceback (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_exception = false
b.r......un # => #<Thread:0x00007fc3f48aefc0@(irb):4 dead>
//}
@see Thread.report_on_exception... -
Thread
. report _ on _ exception -> bool (6106.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...。
Thread.new { 1.times { raise } }
は $stderr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: from -e:1:in `times'
これによって......了しないようにするのがより良い方法です。
* Thread#join や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception = false でレポートを無効化しても
安全です。しか......て
終了を待つことができなかったりするかもしれません。
スレッドごとに設定する方法は Thread#report_on_exception= を参照してください。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを tru... -
Thread
. report _ on _ exception=(newstate) (6106.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...。
Thread.new { 1.times { raise } }
は $stderr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: from -e:1:in `times'
これによって......了しないようにするのがより良い方法です。
* Thread#join や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception = false でレポートを無効化しても
安全です。しか......て
終了を待つことができなかったりするかもしれません。
スレッドごとに設定する方法は Thread#report_on_exception= を参照してください。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを tru... -
net
/ imap (6006.0) -
このライブラリは Internet Message Access Protocol (IMAP) の クライアントライブラリです。2060 を元に 実装されています。
...リは Internet Message Access Protocol (IMAP) の
クライアントライブラリです。2060 を元に
実装されています。
=== IMAP の概要
IMAPを利用するには、まずサーバに接続し、
Net::IMAP#authenticate もしくは
Net::IMAP#login で認証します。
IMAP で......。
Unixシステムでは、ディレクトリ階層上の
ファイルを個々のメールボックスとみなして実装されることが多いです。
メールボックス内のメッセージ(メール)を処理する場合、
まず Net::IMAP#select もしくは
Net::IMAP#examine で処......クス(INBOX)の送り元とサブジェクトを表示する。
require 'net/imap'
imap = Net::IMAP.new('mail.example.com')
imap.authenticate('LOGIN', 'joe_user', 'joes_password')
imap.examine('INBOX')
imap.search(["RECENT"]).each do |message_id|
envelope = imap.fetch(message_id, "EN... -
Exception
# full _ message(highlight: true , order: :bottom) -> String (3212.0) -
例外の整形された文字列を返します。
...して実際に、キーワード引数 highlight と order は 2.5.1 で追加されました。
@param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。......デフォルト値は Exception.to_tty? が真なら :bottom で偽なら :top です。
//emlist[例][ruby]{
begin
raise "test"
rescue => e
p e.full_message # => "\e[1mTraceback \e[m(most recent call last):\ntest.rb:2:in `<main>': \e[1mtest (\e[4;1mRuntimeError\e[m\e[1m)\n\e[m"
$stder......r = $stdout
p e.full_message # => "test.rb:2:in `<main>': test (RuntimeError)\n"
$stderr = STDERR
p e.full_message # => "\e[1mTraceback \e[m(most recent call last):\ntest.rb:2:in `<main>': \e[1mtest (\e[4;1mRuntimeError\e[m\e[1m)\n\e[m"
end
//}
@see Exception.to_tty?......プシーケンスによる文字装飾がついています。
@param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。
@param order :top か :bottom... -
Net
:: IMAP :: StatusData # attr -> { String => Integer } (3206.0) -
STATUS 応答の内容をハッシュで返します。
...STATUS 応答の内容をハッシュで返します。
ハッシュのキーは
"MESSAGES", "RECENT", "UIDNEXT", "UIDVALIDITY", "UNSEEN"
などが使われます。
詳しくは 2060 の 6.3.10、7.2.4 を見てください。... -
Net
:: IMAP # status(mailbox , attr) -> {String => Integer} (3112.0) -
STATUS コマンドを送り、mailbox のステータスを得ます。
...ailbox のステータスを得ます。
問い合わせたいステータスは attr に文字列の配列で渡します。
返り値は アトリビュート文字列をキーとするハッシュです。
詳しくは 2060 の 6.3.10 を参考にしてください。
例:
p imap.status("in......box", ["MESSAGES", "RECENT"])
#=> {"RECENT"=>0, "MESSAGES"=>44}
@param mailbox 問い合わせ対象のメールボックス(文字列)
@param attr 問合せたいアトリビュート名(文字列)の配列
@raise Net::IMAP::NoResponseError メールボックスが存在しない場合や、... -
Net
:: IMAP # select(mailbox) -> Net :: IMAP :: TaggedResponse (3106.0) -
SELECT コマンドを送り、指定したメールボックスを処理対象の メールボックスにします。
...ected」になります。
このコマンドを実行した直後に Net::IMAP#responses["EXISTS"].last
を調べると、メールボックス内のメールの数がわかります。
また、Net::IMAP#responses["RECENT"].lastで、
最新のメールの数がわかります。
これらの値......とに注意してください。
Net::IMAP#add_response_handler を使うとそのような更新情報を
即座に取得できます。
@param mailbox 処理対象としたいメールボックスの名前(文字列)
@raise Net::IMAP::NoResponseError mailboxが存在しない等の理由でコ... -
NEWS for Ruby 2
. 7 . 0 (12.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ルか bugs.ruby-lang.org の issue を参照してください。
== 2.6.0 以降の変更
=== 言語仕様の変更
==== パターンマッチ
* パターンマッチが実験的機能として導入されました。 14912
//emlist[][ruby]{
case [0, [1, 2, 3]]
in [a, [b, *c]]
p a #=> 0......nd
//}
//emlist[][ruby]{
case {a: 0, b: 1}
in {a: 0, x: 1}
:unreachable
in {a: 0, b: var}
p var #=> 1
end
//}
//emlist[][ruby]{
case -1
in 0 then :unreachable
in 1 then :unreachable
end #=> NoMatchingPatternError
//}
//emlist{
json = <<END
{
"name": "Alice",
"age": 30,
"children": [{ "n......ist[test.rb][ruby]{
require "optparse"
OptionParser.new do |opts|
opts.on("-f", "--foo", "foo") {|v| }
opts.on("-b", "--bar", "bar") {|v| }
opts.on("-c", "--baz", "baz") {|v| }
end.parse!
//}
//emlist{
$ ruby test.rb --baa
Traceback (most recent call last):
test.rb:7:in `<main>': invalid opti...