ライブラリ
- ビルトイン (88)
-
irb
/ context (11) - objspace (11)
- tracer (22)
クラス
- Proc (11)
-
RubyVM
:: InstructionSequence (11) - Thread (22)
- Tracer (22)
モジュール
- Kernel (11)
- ObjectSpace (33)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - Binding (11)
- Context (11)
-
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) - Ruby プログラムの実行 (11)
-
add
_ filter (22) -
add
_ trace _ func (11) -
count
_ tdata _ objects (11) -
define
_ finalizer (22) - irb (11)
- of (11)
-
proc
_ binding (11) -
rb
_ obj _ is _ block (11) -
ruby 1
. 6 feature (11) -
ruby 1
. 9 feature (11) -
set
_ trace _ func (22)
検索結果
先頭5件
-
Tracer
. add _ filter(proc) (136.0) -
トレース出力するかどうかを決定するフィルタを追加します。 何もフィルタを与えない場合はすべての行についてトレース情報が出力されます。 与えられた手続き(ブロックまたはProcオブジェクト)が真を返せば トレースは出力されます。
...られた手続き(ブロックまたはProcオブジェクト)が真を返せば
トレースは出力されます。
フィルタは複数追加でき、
そのうち一つでも偽を返すとトレースの出力は抑制されます。
@param proc トレース出力するかどうかを決......します。
通常、true か falseを返す必要があります。
フィルタ手続きは引数として event, file, line, id, binding, klass の
6 つをとります。
Kernel.#set_trace_func で指定するものとほぼ同じです。
=== フィルタ手続きのパラメー......処理している行番号
: id
最後に呼び出されたメソッドのメソッド名(のシンボル)
そのようなメソッドがなければ0になる。
: binding
現在のコンテキスト
: klass
現在呼び出されているメソッドのクラスオブジェクト。... -
ObjectSpace
. # define _ finalizer(obj) {|id| . . . } -> Array (87.0) -
obj が解放されるときに実行されるファイナライザ proc を 登録します。同じオブジェクトについて複数回呼ばれたときは置き換えで はなく追加登録されます。固定値 0 と proc を配列にして返します。
...obj が解放されるときに実行されるファイナライザ proc を
登録します。同じオブジェクトについて複数回呼ばれたときは置き換えで
はなく追加登録されます。固定値 0 と proc を配列にして返します。
ブロックを指定した場......ょう。
@param obj ファイナライザを登録したいオブジェクトを指定します。
@param proc ファイナライザとして Proc オブジェクトを指定します。proc は obj の回収時に obj の ID を引数として実行されます。
=== 使い方の注意
以下......いでしょう。
//emlist[例][ruby]{
class Baz
def initialize
ObjectSpace.define_finalizer self, eval(%q{
proc {
raise "baz" rescue puts $!
raise "baz2"
puts "baz3"
}
}, TOPLEVEL_BINDING)
end
end
Baz.new
GC.start
# => baz
//}
@see spec/rubycmd... -
NEWS for Ruby 2
. 7 . 0 (78.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...==== ブロックなしの proc/lambda が deprecated
* ブロック付きで呼び出されたメソッドの中で、ブロックなしでProc.newやKernel#procを
呼び出すと警告が表示されるようになりました。
//emlist[][ruby]{
def foo
proc
end
foo { puts "Hello" }......#=> warning: Capturing the given block using Kernel#proc is deprecated; use `&block` instead
//}
* 非推奨に関する警告を止めたい場合は、コマンドライン引数に
「-W:no-deprecated」を指定するか、コードの中で
「Warning[:deprecated] = false」
と......ました。
* ERB
* ERBのインスタンスをMarshalできないようになりました。
* IRB
* Pry gem に着想を得て、Binding#irbのソース表示、REPLの入力、
いくつかのコアクラスオブジェクトのinspect出力に
シンタックスハイ... -
NEWS for Ruby 2
. 6 . 0 (72.0) -
NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...した。 13784
* Binding
* 新規メソッド
* Binding#source_location 追加 14230
* bindingのソースコード上の位置を __FILE__ と __LINE__ の二要素配列として返します。
従来でも eval("[__FILE__, __LINE__]", binding) とすることでこ......れらの情報は得られましたが、
将来的に Kernel.#eval は binding のソースコード行を無視する変更を予定しているため 4352、
この新しいメソッドを用いることが今後は推奨されます。
* Dir
* 新規メソッド......しいキーと値に変換できるようになりました。 15143
* Proc
* 新規メソッド
* 関数合成用に Proc#<< と Proc#>> が追加されました。 6284
* 非互換な変更
* Proc#call が $SAFE を変更しなくなりました。 14250
* Random
*... -
ruby 1
. 9 feature (72.0) -
ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。
...除
=== 2006-06-11
: __callee__ [new]
: __method__ [new]
((<URL:http://www.dm4lab.to/~usa/ruby/d/200606a.html#id20060610_P1_7>))
: Symbol#to_proc
=== 2006-06-10
* 新機能
: BasicObject が導入されました [new]
: local という visibility および Module#local, Module#local_meth......が 1文字の String を返すようになりました
* 多重代入、引数渡し
: 多重代入や yield の何かが変わりました
: Proc#yield が導入されました
: nil.yield が導入されました。no block given (LocalJumpError) という例外を生成します
: 仮......utbuf]) [lib][new]
追加。((<ruby-dev:24061>))
=== 2004-08-19
: Binding#eval(expr[, fname[, lineno=1]]) [new]
追加。((<RCR#251>))
: String#clear [new]
追加。((<ruby-dev:24104>))
=== 2004-08-17
: Process.daemon(nochdir=nil,noclose=nil) [new]
追加。((<ruby-dev... -
RubyVM
:: InstructionSequence . of(body) -> RubyVM :: InstructionSequence (64.0) -
引数 body で指定した Proc、Method オブジェクトを元に RubyVM::InstructionSequence オブジェクトを作成して返します。
...引数 body で指定した Proc、Method オブジェクトを元に
RubyVM::InstructionSequence オブジェクトを作成して返します。
@param body Proc、Method オブジェクトを指定します。
例1:irb で実行した場合
# proc
> p = proc { num = 1 + 2 }
> RubyVM::In......structionSequence.of(p)
> # => <RubyVM::InstructionSequence:block in irb_binding@(irb)>
# method
> def foo(bar); puts bar; end
> RubyVM::InstructionSequence.of(method(:foo))
> # => <RubyVM::InstructionSequence:foo@(irb)>
例2: RubyVM::InstructionSequence.compile_file を使用した場......$a_global_proc = proc { str = 'a' + 'b' }
# irb
> require '/tmp/iseq_of.rb'
# hello メソッド
> RubyVM::InstructionSequence.of(method(:hello))
> # => #<RubyVM::InstructionSequence:0x007fb73d7cb1d0>
# グローバル proc
> RubyVM::InstructionSequence.of($a_global_proc)
> # =>... -
IRB
:: Context (60.0) -
irb の設定を扱うためのクラスです。
...メソッドとして操作できません。
: IRB.conf[:AT_EXIT]
irb の終了時(サブ irb を含みません)に本項目に設定された Proc オ
ブジェクトを実行します。ブロック引数には何も渡されません。
デフォルト値は [] です。
: IRB.conf[:C......ークスペースに関連する Binding オブジェクトの作成方法を
Integer で設定します。
0 を指定した場合、Object::TOPLEVEL_BINDING の Proc 内の
Binding を使用します。1 を指定した場合、Tempfile 中の
Binding を使用します。2 を指定し......た場合、Thread 内で読み込
んだファイル中の Binding を使用します。3 を指定した場合、
Object::TOPLEVEL_BINDING の関数中の Binding を使用します。
ただし、IRB.conf[:SINGLE_IRB] に true を設定していた場合は、現在のワー
クスペー... -
irb (60.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
...しろから n だけ行なう。デフォルト値は 16。
--context-mode n 新しいワークスペースを作成した時に関連する Binding
オブジェクトの作成方法を 0 から 3 で設定する。
(IRB::Context 参照)
--single-irb......irb#1(main):001:0> x # x を表示
NameError: undefined local variable or method `x' for main:Object
from (irb#1):1:in `Kernel#binding'
起動時のインタプリタでローカル変数 x を定義しましたが、
「irb」でサブ irb を起動すると、
ローカル変......す。
そこで、IRB.conf[:IRB_RC] を使う方法を紹介します。
IRB.conf[:IRB_RC] に Proc オブジェクトを設定しておくと、
サブ irb が起動されるたびに、その Proc オブジェクトに
IRB::Context オブジェクトを渡して実行します。
これによっ... -
NEWS for Ruby 3
. 0 . 0 (54.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ror or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166
//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}
pr.call([1])......'--', 'data1', '--', 'data2', '--', 'data3']
dirty_data[(1..).step(2)] # take each second element
# => ["data1", "data2", "data3"]
//}
* Binding
* Binding#eval when called with one argument will use `"(eval)"` for `__FILE__` and `1` for `__LINE__` in the evaluated code. 4352 17419
* Conditi......be compatible for essentially all usages and avoids blocking when using a scheduler. 16792
* Proc
* Proc#== and Proc#eql? are now defined and will return true for separate Proc instances if the procs were created from the same block. 14267
* Queue / SizedQueue
* Queue#pop, SizedQueue#pu... -
NEWS for Ruby 2
. 1 . 0 (48.0) -
NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...* 追加: Array#to_h キーと値のペアの配列をハッシュに変換します。
* Binding
* 追加: Binding#local_variable_get
* 追加: Binding#local_variable_set
* 追加: Binding#local_variable_defined?
* Enumerable
* 追加: Enumerable#to_h キーと値のペア......とができます。
* Process
* 追加: Process.#argv0 オリジナルの $0 の値を返します。
* 追加: Process.#setproctitle $0 に影響を与えずにプロセス名をセットできます。
* 追加: Process.#clock_gettime
* 追加: Process.#clock_getres
* Strin......はなく TypeError を発生させるようになりました。
* Proc
* Returning from lambda proc now always exits from the Proc, not from the
method where the lambda is created. Returning from non-lambda proc exits
from the method, same as the former behavior.
* String... -
static VALUE rb
_ obj _ is _ block(VALUE block) (48.0) -
proc が Proc または Binding のインスタンスであれば真。
...
proc が Proc または Binding のインスタンスであれば真。...