種類
- 文書 (56)
- モジュール関数 (36)
- インスタンスメソッド (36)
- クラス (12)
- ライブラリ (12)
ライブラリ
- ビルトイン (84)
モジュール
- Kernel (36)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) -
NEWS for Ruby 2
. 5 . 0 (8) - Thread (12)
- [] (12)
- abort (24)
- exit (12)
-
initialize
_ copy (12) - irb (12)
-
ruby 1
. 6 feature (12) - クラス/メソッドの定義 (12)
- スレッド (12)
検索結果
先頭5件
-
Exception
# inspect -> String (18113.0) -
self のクラス名と message を文字列にして返します。
...self のクラス名と message を文字列にして返します。
//emlist[例][ruby]{
begin
raise "exception"
rescue
p $!.inspect # => "#<RuntimeError: exception>"
end
//}... -
irb (102.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
...示する (デフォルト)
--noecho 実行結果を表示しない
--inspect 結果出力にinspectを用いる (bc モード以外ではデフォルト)
--noinspect 結果出力にinspectを用いない
--readline readlineライブラリを利用する
--nor......= nil
IRB.conf[:EVAL_HISTORY] = nil
IRB.conf[:HISTORY_FILE] = nil
IRB.conf[:IGNORE_EOF] = true
IRB.conf[:IGNORE_SIGINT] = true
IRB.conf[:INSPECT_MODE] = nil
IRB.conf[:IRB_NAME] = "irb"
IRB.conf[:IRB_RC] = nil
IRB.conf[:MATH_MODE] = false
IRB.conf[:PROMPT] = {....}
IRB.conf[:PROMP......ます。
Ruby と irb の動作の違いをなくしたい場合は、 irb では以下のように式を begin 〜 end でくくって入力してください。
irb(main):001:1* begin
irb(main):002:1* eval "foo"
irb(main):003:1* foo = 42
irb(main):004:0> end
==== ヒアドキュメン......実行結果を表示する (デフォルト)
--noecho 実行結果を表示しない
--inspect 結果出力にinspectを用いる
--noinspect 結果出力にinspectを用いない
--readline readlineライブラリを利用する
--noreadline readline......= nil
IRB.conf[:EVAL_HISTORY] = nil
IRB.conf[:HISTORY_FILE] = nil
IRB.conf[:IGNORE_EOF] = true
IRB.conf[:IGNORE_SIGINT] = true
IRB.conf[:INSPECT_MODE] = nil
IRB.conf[:IRB_NAME] = "irb"
IRB.conf[:IRB_RC] = nil
IRB.conf[:PROMPT] = {....}
IRB.conf[:PROMPT_MODE] = :DEFAULT
IRB.conf[:... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (42.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...776>))
: ((<"rescue/ensure on begin .. end while"|制御構造/while 修飾子>)) [compat]
rescue/ensure を持つ begin 式も while/until 修飾できるようになりまし
た。
以前は、rescue/ensure を持つ while/until 修飾式は、通常の begin 式に
while/until 修飾......ス/メソッド(互換性のある変更)
=== 組み込み関数
: ((<組み込み関数/sprintf>)) [new]
"%p" が追加されました。inspect の結果が利用されます。((<RCR#69>))
: ((<組み込み関数/trap>)) [compat]
あるシグナルに対して、SIG_DFL や SIG_IGN......IO#read, IO#sysread に第二引数追加(あらかじめ割り当てた読み込み用バッ
ファの指定)
=== Method
: ((<Method#inspect|Method/inspect>)) [compat]
特異メソッドに対する出力形式がより意味のあるものになりました。
((<ruby-bugs-ja:PR#193>))... -
クラス/メソッドの定義 (42.0)
-
クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined
...大文字で始まる識別子です。
rescue/ensure 節を指定し、例外処理ができます。
例外処理についてはd:spec/control#begin参照。
クラス定義は、識別子で指定した定数へのクラスの代入になります
(Ruby では、クラスもオブジェクト......クトには引き継がれません.
rescue/ensure 節を指定し、例外処理ができます。
例外処理についてはd:spec/control#begin参照。
特異クラス定義式は、最後に評価した式の結果を返します。最後に評価した式
が値を返さない場合は n......れる機能です。
このような引数は 1 つしか作れません。
//emlist[例][ruby]{
def foo(x, *xs)
puts "#{x} : #{xs.inspect}" # Object#inspect は p のような詳細な内部表示
end
foo(1) #=> 1 : []
foo(1, 2) #=> 1 : [2]
foo(1, 2, 3) #=> 1 : [2, 3]
def bar(x,... -
Kernel
. # exit(status = true) -> () (30.0) -
Rubyプログラムの実行を終了します。status として整 数が与えられた場合、その値を Ruby コマンドの終了ステータスとします。 デフォルトの終了ステータスは 0(正常終了)です。
...に応じて begin 節で捕捉することができます。
@param status 終了ステータスを整数か true または false で与えます。
//emlist[例][ruby]{
puts 'start'
begin
puts 'start1...'
exit
rescue SystemExit => err
puts "end1 with #{err.inspect}"
end
begin
puts 'star......t2...'
exit
ensure
puts 'end2...'
end
puts 'end' #実行されない
#=> start
# start1...
# end1 with #<SystemExit: exit>
# start2...
# end2...
#終了ステータス:0
//}
@see Kernel.#exit!,Kernel.#abort, d:spec/control#begin... -
ruby 1
. 6 feature (24.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...; make sure
ruby 1.6.7 (2002-05-04) [i586-linux]
"\\t"
nil
: 2002-04-20: Regexp#inspect
/x フラグ付きの正規表現オブジェクトの inspect が改行を \n に変換して
いました。((<ruby-bugs-ja:PR#225>))
p /a
b/x......uby-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.6.7 (2002-03-01) [i586-linux]
/\\//
=> ruby 1.6.7 (2002-05-04) [i586-linux]......問題に対処しました。((<ruby-dev:13194>))
: Ctrl-C (Interrupt)が効かなくなる
((<ruby-dev:13195>))
th1 = Thread.start {
begin
Thread.stop
ensure
Thread.pass
Thread.stop
end
}
sleep 1
(確認できる限りでは ruby-1.7.0... -
Kernel
. # abort -> () (18.0) -
Ruby プログラムをエラーメッセージ付きで終了します。終了ステータスは 1 固定です。
...@param message エラーメッセージ文字列です。
//emlist[][ruby]{
puts 'start'
begin
puts 'start1...'
abort "error1"
rescue SystemExit => err
puts "end1 with #{err.inspect}"
end
begin
puts 'start2...'
raise RuntimeError.new
rescue
abort
ensure
puts 'end2...'
end
puts 'en......。
@param message エラーメッセージ文字列です。
//emlist[][ruby]{
puts 'start'
begin
puts 'start1...'
abort "error1"
rescue SystemExit => err
puts "end1 with #{err.inspect}"
end
begin
puts 'start2...'
raise RuntimeError.new
rescue
abort
ensure
puts 'end2...'
end
puts '... -
Kernel
. # abort(message) -> () (18.0) -
Ruby プログラムをエラーメッセージ付きで終了します。終了ステータスは 1 固定です。
...@param message エラーメッセージ文字列です。
//emlist[][ruby]{
puts 'start'
begin
puts 'start1...'
abort "error1"
rescue SystemExit => err
puts "end1 with #{err.inspect}"
end
begin
puts 'start2...'
raise RuntimeError.new
rescue
abort
ensure
puts 'end2...'
end
puts 'en......。
@param message エラーメッセージ文字列です。
//emlist[][ruby]{
puts 'start'
begin
puts 'start1...'
abort "error1"
rescue SystemExit => err
puts "end1 with #{err.inspect}"
end
begin
puts 'start2...'
raise RuntimeError.new
rescue
abort
ensure
puts 'end2...'
end
puts '... -
NEWS for Ruby 2
. 5 . 0 (12.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ました 11952
* Process.last_status を追加。$? と同じです 14043
* Range
* Range.new no longer hides exceptions when comparing begin and
end with #<=> and raise a "bad value for range" ArgumentError
but instead lets the exception from the #<=> call go through.......ps://blog.rubygems.org/2017/08/27/2.6.13-released.html
* securerandom
* SecureRandom.alphanumeric を追加
* set
* Set#to_s を Set#inspect の別名として追加 13676
* Set#=== を Set#include? の別名として追加 13801
* Set#reset 6589
* stringio
* StringIO#wr...