ライブラリ
- ビルトイン (12)
モジュール
- Kernel (12)
キーワード
-
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) - irb (12)
- rdoc (12)
-
set
_ trace _ func (12) - 制御構造 (12)
検索結果
-
debug (38012.0)
-
Ruby デバッガです。Ruby スクリプトのソースコードデバッグに使用します。
...したインタフェース rubydb3x.el が
https://github.com/ruby/elisp にあるので、活用してください。
=== 使い方
$ ruby -rdebug foo.rb
または、Emacs から
M-x load-library rubydb3x.el
M-x rubydb
=== デバッグコマンド
以下は、デバッガで使用......ここに挙げたもの以外を入力した場合、その入力を ruby の式として評価します。
: break
: break [<file>:]<position>|<class>:<method>
ブレークポイントを設定します。引数を省略した場合設定したブレークポ
イントを表示します......タンス変数、<object>の定数を表示します。
このコマンドの省略形は v です。
: method i[nstance] <object>
: method <class|module>
それぞれ、オブジェクト<object>のインスタンスメソッド
クラスメソッド または モジュールメソ... -
NEWS for Ruby 3
. 0 . 0 (96.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...d in singleton class definitions in methods is now a SyntaxError
instead of a warning. yield in a class definition outside of a method
is now a SyntaxError instead of a LocalJumpError. 15575
* When a class variable is overtaken by the same definition in an
ancestor class/module, a Run......timeError 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 line options
==......ault gems
* The following libraries are promoted to default gems from stdlib.
* English
* abbrev
* base64
* drb
* debug
* erb
* find
* net-ftp
* net-http
* net-imap
* net-protocol
* open-uri
* optparse
* pp... -
NEWS for Ruby 3
. 1 . 0 (90.0) -
NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...* Class
* 新規メソッド
* Class#subclassesはレシーバを継承した子クラスを要素に持つ配列(シングルトンクラスを含まない)を返します。
//emlist[Class#subclasses][ruby]{
class A; end
class B < A; end
class C < B; end
class D < A; end
A.subclasses......#=> [D, B]
B.subclasses #=> [C]
C.subclasses #=> []
//}
* Enumerable
* 新規メソッド
* Enumerable#compactが追加されました。 17312
* Enumerable#tallyがカウント集計用のハッシュオブジェクトを任意で渡せるようになりました。 1774......更されました。
* net-ftp 0.1.3
* net-imap 0.2.2
* net-pop 0.1.1
* net-smtp 0.3.1
* matrix 0.4.2
* prime 0.1.2
* debug 1.4.0
* 以下が標準添付ライブラリから削除されました。
* dbm
* gdbm
* tracer
* Coverageの計測が一時停... -
Kernel
. # set _ trace _ func(proc) -> Proc (66.0) -
Ruby インタプリタのイベントをトレースする Proc オブジェクトとして 指定された proc を登録します。 nil を指定するとトレースがオフになります。
...発生する度に、以下で説明する6個の引数とともに
登録された Proc オブジェクトを実行します。
標準添付の debug、tracer、
profile はこの組み込み関数を利用して実現されています。
=== ブロックパラメータの意味
渡す Proc オ......c-call": Cで記述されたメソッドの呼び出し。
"c-return": Cで記述されたメソッド呼び出しからのリターン。
"class": クラス定義、特異クラス定義、モジュール定義への突入。
"end": クラス定義、特異クラス定義、モ......ルでは nil。
call/return/c-call/c-return
呼び出された/リターンするメソッドを表す Symbol オブジェクト。
class/end
nil。
raise
最後に呼び出されたメソッドを表す Symbol オブジェクト。
トップレベルで... -
rdoc (36.0)
-
RDoc は Ruby のドキュメント生成を行うためのライブラリです。rdoc という ドキュメント生成のためのコマンドも含んでいます。
...no-dcov
ドキュメントが記述されていない要素に関するレポートを出力しません。
: --debug
実行時に内部情報を出力します。
: --no-debug
実行時に内部情報を出力しません。
: --diagram
何もしません。--diagram オプション......source directory. Default is
the current directory.
: --page-dir dir
Directory where guides, your FAQ or other pages not associated with
a class live. Set this when you don't store such files at your
project root. NOTE: Do not use the same file name in the page dir
and the root of your......。これをオフにしたい場合は all 修飾
子を加えます。
//emlist{
module SM #:nodoc:
class Input
end
end
module Markup #:nodoc: all
class Output
end
end
//}
以上のコードでは、SM::Input のドキュメントのみが出力され... -
irb (30.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
...は Ruby の式を入力するだけで、その式が実行され、結果が表示されます。
irb(main):001:0> 1+2
3
irb(main):002:0> class Foo
irb(main):003:1> def foo
irb(main):004:2> print 1
irb(main):005:2> end
irb(main):006:1> end
:foo
irb(main):007:0>
また i......ns:
-f ~/.irbrc を読み込まない
-m bc モード (分数と行列の計算ができる)
-d $DEBUG を true にする (ruby -d と同じ)
-w ruby -w と同じ
-W[level=2] ruby -W と同じ
-r library ruby -r と......参照)
--single-irb irb 中で self を実行して得られるオブジェクトをサブ irb と共
有する
--irb_debug n irb のデバッグレベルを n に設定する
(ユーザは利用すべきではない)
-v, --version irb の......ンドラインオプション
irb [options] file_name opts
options:
-f ~/.irbrc を読み込まない
-d $DEBUG を true にする (ruby -d と同じ)
-w ruby -w と同じ
-W[level=2] ruby -W と同じ
-r library ruby -r と... -
制御構造 (30.0)
-
制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END
...に
//emlist[][ruby]{
$_ =~ リテラル
//}
であるかのように評価されます。
==== if 修飾子
//emlist[例][ruby]{
print "debug\n" if $DEBUG
//}
文法:
式 if 式
右辺の条件が成立する時に、左辺の式を評価してその結果を返します。
条件......いがそうはならない
//}
代わりにそのようなメソッド(イテレータ)を定義する必要があります。
//emlist[][ruby]{
class Array
def each2
i = 0
while i < self.size
yield self[i], self[i+1]
i += 2
end
end
end
//}
====[a:break] break
//emli......各節において文が存在しなかったときの値
はnilです。いずれにしてもensure節の値は無視されます。
d:spec/def#class、d:spec/def#module、d:spec/def#method
などの定義文では、それぞれ
begin なしで rescue, ensure 節を定義でき、これにより... -
NEWS for Ruby 2
. 3 . 0 (24.0) -
NEWS for Ruby 2.3.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...g-literal というコマンドラインオプションも導入されました
8976
* コマンドラインオプションに --debug または --debug=frozen-string-literal を付けて実行すると、
freeze された文字列を操作しようとして RuntimeError が発生し......bjectSpace (objspace)
* ObjectSpace.#count_symbols を追加。
* ObjectSpace.#count_imemo_objects を追加。
* ObjectSpace.#internal_class_of を追加。
* ObjectSpace.#internal_super_of を追加。
* OpenSSL
* OpenSSL::SSL::SSLSocket#accept_nonblock と
OpenSSL::SS......$SAFE=3 が廃止されました。$SAFE を2以上にすると ArgumentError が発生します。
5455
=== C API の更新
* rb_define_class_id_under() は既にクラスが定義済みなのに、
そのスーパークラスが与えられたスーパークラスと一致しない...