46件ヒット
[1-46件を表示]
(0.024秒)
別のキーワード
種類
- 文書 (24)
- インスタンスメソッド (11)
- 特異メソッド (11)
ライブラリ
- ビルトイン (22)
キーワード
-
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 3
. 0 . 0 (4) -
pending
_ interrupt? (11) - 制御構造 (11)
検索結果
先頭5件
-
Exception
# ==(other) -> bool (18152.0) -
自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。
...自身と指定された other のクラスが同じであり、
message と backtrace が == メソッドで比較して
等しい場合に true を返します。そうでない場合に false を返します。
@param other 自身と比較したいオブジェクトを指定します。......month, -1).day == 31
raise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
results = [2, 2, 4].map { |e | get_exception { check_long_month(e) } }
p results.map { |e| e.class }
# => [RuntimeError, RuntimeError, RuntimeError]
p results.map......is not long month", "2 is not long month", "4 is not long month"]
# class, message, backtrace が同一のため true になる
p results[0] == results[1] # => true
# class, backtrace が同一だが、message がことなるため false になる
p results[0] == results[2] # => false
//}... -
NEWS for Ruby 3
. 0 . 0 (72.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリストはリンク先を参照してください。
== 言語仕様の変更
* Keyword arguments are now separated from positional arguments.
Code that resulted in deprecation warnings in Ruby 2.......s/module, a RuntimeError is now raised (previously,
it only issued a warning in verbose mode). Additionally, accessing a
class variable from the toplevel scope is now a RuntimeError.
14541
* Assigning to a numbered parameter is now a SyntaxError instead of
a warning.
== Command l......ine options
=== `--help` option
When the environment variable `RUBY_PAGER` or `PAGER` is present and has
a non-empty value, and the standard input and output are tty, the `--help`
option shows the help message via the pager designated by the value.
16754
=== `--backtrace-limit` option
The `--bac... -
制御構造 (54.0)
-
制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END
...御構造をクラス設計者が定義する事が出来るものです.
=== 条件分岐
====[a:if] if
//emlist[例][ruby]{
if age >= 12 then
print "adult fee\n"
else
print "child fee\n"
end
gender = if foo.gender == "male" then "male" else "female" end
//}
文法:
if 式 [then]......価されます。
==== if 修飾子
//emlist[例][ruby]{
print "debug\n" if $DEBUG
//}
文法:
式 if 式
右辺の条件が成立する時に、左辺の式を評価してその結果を返します。
条件が成立しなければ nil を返します。
====[a:unless] unless
//e......}
rescue 節以外で retry が用いられた場合には例外 SyntaxError が発生
します。
=== 例外処理
====[a:raise] raise
//emlist[例][ruby]{
raise "you lose" # 例外 RuntimeError を発生させる
# 以下の二つは SyntaxError を発生させる
raise SyntaxError, "invalid... -
Thread
. pending _ interrupt?(error = nil) -> bool (18.0) -
非同期割り込みのキューが空かどうかを返します。
...ead.kick_interrupt_immediately
Thread.handle_interrupt(Object => :immediate) {
Thread.pass
}
end
=== 使い方
th = Thread.new{
Thread.handle_interrupt(RuntimeError => :on_blocking){
while true
...
# ここまでで割り込みが発生しても安全な......flag = true
th = Thread.new{
Thread.handle_interrupt(RuntimeError => :on_blocking){
while true
...
# ここまでで割り込みが発生しても安全な状態になった。
break if flag == false
...
end
}
}
...
flag = false # ス... -
NEWS for Ruby 2
. 3 . 0 (12.0) -
NEWS for Ruby 2.3.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...共に書かれた全ての変更のリストは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。
== 2.2.0 以降の変更
=== 言語仕様の変更
* frozen-string-literal プラグマ:
* 実験的な機能として fronzen-string-literal というプ......ンに --debug または --debug=frozen-string-literal を付けて実行すると、
freeze された文字列を操作しようとして RuntimeError が発生したときにそのオブジェクトが生成された位置を表示します。
11725
* safe navigation operator (ぼ......ヒアドキュメント:
* 新しい文字列リテラルとして <<~ で始まるヒアドキュメントが追加されました
9098
=== 組み込みクラスの更新
* ARGF
* ARGF.read_nonblock は IO#read_nonblock と同じように `exception: false' オプションをサ...