ライブラリ
- ビルトイン (474)
-
irb
/ context (12) -
irb
/ inspector (12) - json (24)
-
minitest
/ unit (8) - objspace (12)
- prettyprint (12)
-
shell
/ command-processor (6) -
shell
/ process-controller (6)
クラス
- Hash (81)
-
IRB
:: Inspector (12) - LocalJumpError (12)
- Method (12)
- Object (60)
- PrettyPrint (12)
- Proc (31)
-
Shell
:: CommandProcessor (6) -
Shell
:: ProcessController (6) - Symbol (4)
- TracePoint (7)
- UnboundMethod (12)
モジュール
- Enumerable (48)
- JSON (24)
- Kernel (27)
- Marshal (48)
-
MiniTest
:: Assertions (8) - ObjectSpace (48)
-
Process
:: GID (24) -
Process
:: UID (24)
オブジェクト
- main (24)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - Binding (12)
- Context (12)
- Marshal フォーマット (12)
- Method (12)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 1 . 0 (12) -
NEWS for Ruby 2
. 2 . 0 (11) -
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 2
. 6 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) - Ruby プログラムの実行 (12)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- Ruby用語集 (12)
- [] (12)
-
assert
_ empty (1) -
assert
_ equal (1) -
assert
_ includes (1) -
assert
_ instance _ of (1) -
assert
_ kind _ of (1) -
assert
_ nil (1) -
assert
_ respond _ to (1) -
assert
_ same (1) -
count
_ tdata _ objects (12) -
def
_ inspector (12) - default (24)
-
define
_ finalizer (24) -
define
_ method (24) -
define
_ singleton _ method (24) - detect (24)
- drb (12)
- dump (24)
-
each
_ active _ object (6) -
exit
_ value (12) - find (24)
- format (12)
- irb (12)
- lambda (13)
- load (24)
- new (43)
- parameters (43)
- restore (24)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 8 . 3 feature (12) -
ruby 1
. 9 feature (12) - send (24)
- shift (9)
- switch (48)
-
to
_ proc (16) - transact (6)
-
undefine
_ finalizer (12) -
values
_ at (12) - オブジェクト指向スクリプト言語 Ruby リファレンスマニュアル (12)
- クラス/メソッドの定義 (12)
- セキュリティモデル (12)
- メソッド呼び出し(super・ブロック付き・yield) (12)
検索結果
先頭5件
-
Kernel
. # proc -> Proc (15484.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。
ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと......までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。
ブロックを指定しない proc は、Ruby 2.7 では
$VERBOSE = true のときには警......告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。
@raise ArgumentError スタック上にブロックがないのにブロ... -
Kernel
. # proc { . . . } -> Proc (15484.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。
ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと......までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。
ブロックを指定しない proc は、Ruby 2.7 では
$VERBOSE = true のときには警......告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。
@raise ArgumentError スタック上にブロックがないのにブロ... -
Kernel
. # proc -> Proc (15483.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。
ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと......までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。
ブロックを指定しない proc は、Ruby 2.7 では
$VERBOSE = true のときには警......告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。
@raise ArgumentError スタック上にブロックがないのにブロ... -
Kernel
. # proc { . . . } -> Proc (15483.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。
ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと......までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。
ブロックを指定しない proc は、Ruby 2.7 では
$VERBOSE = true のときには警......告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。
@raise ArgumentError スタック上にブロックがないのにブロ... -
Object
# to _ proc -> Proc (15236.0) -
オブジェクトの Proc への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。
...オブジェクトの Proc への暗黙の変換が必要なときに内部で呼ばれます。
デフォルトでは定義されていません。
説明のためここに記載してありますが、
このメソッドは実際には Object クラスには定義されていません。
必要......に応じてサブクラスで定義すべきものです。
//emlist[][ruby]{
def doing
yield
end
class Foo
def to_proc
Proc.new{p 'ok'}
end
end
it = Foo.new
doing(&it) #=> "ok"
//}... -
Proc
. new -> Proc (9168.0) -
ブロックをコンテキストとともにオブジェクト化して返します。
...= true のときには警告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。
ブロックを指定しなければ、この......上にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo
pr = Proc.new
pr.call(1)
end
foo {|arg| p arg }
# => 1
//}
これは以下と同じです。
//emlist[例][ruby]{
def foo
yield(1)
end
foo {|arg| p ar......entError が発生します。
//emlist[例][ruby]{
def foo
Proc.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}
Proc.new は、Proc#initialize が定義されていれば
オブジェクト... -
Proc
. new { . . . } -> Proc (9168.0) -
ブロックをコンテキストとともにオブジェクト化して返します。
...= true のときには警告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。
ブロックを指定しなければ、この......上にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo
pr = Proc.new
pr.call(1)
end
foo {|arg| p arg }
# => 1
//}
これは以下と同じです。
//emlist[例][ruby]{
def foo
yield(1)
end
foo {|arg| p ar......entError が発生します。
//emlist[例][ruby]{
def foo
Proc.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}
Proc.new は、Proc#initialize が定義されていれば
オブジェクト......行ったときに発生します。
//emlist[][ruby]{
pr = Proc.new {|arg| p arg }
pr.call(1) # => 1
//}
//emlist[][ruby]{
Proc.new # => -e:1:in `new': tried to create Proc object without a block (ArgumentError)
//}
Proc.new は、Proc#initialize が定義されていれば
オブジェクトの......初期化のためにこれを呼び出します。このことを
除けば、Kernel.#proc と同じです。... -
Proc
# parameters(lambda: nil) -> [object] (9141.0) -
Proc オブジェクトの引数の情報を返します。
...Proc オブジェクトの引数の情報を返します。
Proc オブジェクトが引数を取らなければ空の配列を返します。引数を取る場合は、配列の配列を返し、
各配列の要素は引数の種類に対応した以下のような Symbol と、引数名を表す......数
: :block
& で指定されたブロック引数
@param lambda true なら lambda として扱ったとき、false なら lambda ではない Proc として
扱ったときの引数の情報を返します。
//emlist[例][ruby]{
prc = lambda{|x, y=42, *other, k_x:, k_y: 42, **k_......_other], [:block, :b
//}
//emlist[lambda: の例][ruby]{
prc = proc{|x, y=42, *other|}
p prc.parameters # => x], [:opt, :y], [:rest, :other
prc = lambda{|x, y=42, *other|}
p prc.parameters # => x], [:opt, :y], [:rest, :other
prc = proc{|x, y=42, *other|}
p prc.parameters(lambda: true) # => x], [... -
Object
# send(name , *args) -> object (9126.0) -
オブジェクトのメソッド name を args を引数に して呼び出し、メソッドの実行結果を返します。
...のメソッドを呼び出せます。
d:spec/def#limit も参照してください。
public メソッドだけ呼び出せれば良い場合は
Object#public_send を使う方が良いでしょう。
@param name 文字列かSymbol で指定するメソッド名です。
@param args 呼び出す......ーバは任意(Foo クラスのインスタンスである必要もない)
p Foo.new.send(methods[1]) # => "foo"
p Foo.new.send(methods[2]) # => "bar"
p Foo.new.send(methods[3]) # => "baz"
//}
@see Object#public_send, BasicObject#__send__, Object#method, Kernel.#eval, Proc, Method... -
Object
# send(name , *args) { . . . . } -> object (9126.0) -
オブジェクトのメソッド name を args を引数に して呼び出し、メソッドの実行結果を返します。
...のメソッドを呼び出せます。
d:spec/def#limit も参照してください。
public メソッドだけ呼び出せれば良い場合は
Object#public_send を使う方が良いでしょう。
@param name 文字列かSymbol で指定するメソッド名です。
@param args 呼び出す......ーバは任意(Foo クラスのインスタンスである必要もない)
p Foo.new.send(methods[1]) # => "foo"
p Foo.new.send(methods[2]) # => "bar"
p Foo.new.send(methods[3]) # => "baz"
//}
@see Object#public_send, BasicObject#__send__, Object#method, Kernel.#eval, Proc, Method... -
Proc
# parameters -> [object] (9123.0) -
Proc オブジェクトの引数の情報を返します。
...Proc オブジェクトの引数の情報を返します。
Proc オブジェクトが引数を取らなければ空の配列を返します。引数を取る場合は、配列の配列を返し、
各配列の要素は引数の種類に対応した以下のような Symbol と、引数名を表す... -
ObjectSpace
. # count _ tdata _ objects(result _ hash = nil) -> Hash (9106.0) -
T_DATA の種類ごとにオブジェクトの数を格納したハッシュを返します。
...ンスに興味のある C Ruby の開発者向けのものです。
//emlist[例][ruby]{
ObjectSpace.count_tdata_objects
# => {RubyVM::InstructionSequence=>504, :parser=>5, :barrier=>6,
# :mutex=>6, Proc=>60, RubyVM::Env=>57, Mutex=>1, Encoding=>99,
# ThreadGroup=>1, Binding=>1, Thread=>1,... -
Shell
:: ProcessController . each _ active _ object {|ref| . . . } -> () (9101.0) -
@todo
@todo -
Object
# define _ singleton _ method(symbol) { . . . } -> Symbol (9006.0) -
self に特異メソッド name を定義します。
...self に特異メソッド name を定義します。
@param symbol メソッド名を String または Symbol で指定します。
@param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。
@return メソッド名を表す Sym...