別のキーワード
種類
- 文書 (94)
- インスタンスメソッド (60)
- モジュール関数 (37)
- ライブラリ (12)
- クラス (12)
クラス
- Method (12)
-
OpenSSL
:: SSL :: SSLContext (12) - PP (12)
- Proc (24)
モジュール
- Kernel (37)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) -
NEWS for Ruby 2
. 1 . 0 (12) -
NEWS for Ruby 2
. 2 . 0 (11) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) - Proc (12)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- irb (12)
- lambda? (12)
- parameters (12)
- proc (19)
-
renegotiation
_ cb= (12) -
ruby 1
. 9 feature (12) - seplist (12)
-
to
_ proc (12) - メソッド呼び出し(super・ブロック付き・yield) (12)
- 手続きオブジェクトの挙動の詳細 (12)
検索結果
先頭5件
-
Kernel
. # lambda { . . . } -> Proc (18251.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...します。
また、lambda に & 引数を渡すのは推奨されません。& 引数ではなくてブロック記法で記述する必要があります。
& 引数を渡した lambda は Warning[:deprecated] = true のときに警告メッセージ
「warning: lambda without a literal block......is deprecated; use the proc without lambda instead」
を出力します。
@raise ArgumentError ブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo &block
lambda(&block)
end
it = foo{p 12}
it.call #=> 12
//}
@see Proc,Proc.new
===[a:sh......合、lambda では手続きオブジェクト自身を抜けますが、
Proc.new では手続きオブジェクトを囲むメソッドを抜けます。
//emlist[例][ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end
def test_lambda
f = lambda { retu......is deprecated; use the proc without lambda instead」
を出力します。
@raise ArgumentError ブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo &block
proc(&block)
end
it = foo{p 12}
it.call #=> 12
//}
@see Proc,Proc.new
===[a:shou... -
Kernel
. # lambda -> Proc (18234.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...のメソッドで指定されたブロック
を得たい場合は明示的に & 引数でうけるべきです。
ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
Argument......にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo &block
lambda(&block)
end
it = foo{p 12}
it.call #=> 12
//}
@see Proc,Proc.new
===[a:should_use_next] 手続きを中断して値を返す
手続きオブ......合、lambda では手続きオブジェクト自身を抜けますが、
Proc.new では手続きオブジェクトを囲むメソッドを抜けます。
//emlist[例][ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end
def test_lambda
f = lambda { retu... -
Kernel
. # lambda { . . . } -> Proc (18234.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...のメソッドで指定されたブロック
を得たい場合は明示的に & 引数でうけるべきです。
ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
Argument......にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo &block
lambda(&block)
end
it = foo{p 12}
it.call #=> 12
//}
@see Proc,Proc.new
===[a:should_use_next] 手続きを中断して値を返す
手続きオブ......合、lambda では手続きオブジェクト自身を抜けますが、
Proc.new では手続きオブジェクトを囲むメソッドを抜けます。
//emlist[例][ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end
def test_lambda
f = lambda { retu... -
Method
# to _ proc -> Proc (9018.0) -
self を call する Proc オブジェクトを生成して返します。
...self を call する Proc オブジェクトを生成して返します。
//emlist[例][ruby]{
class Foo
def foo
"foo"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
pr = m.to_proc # => #<Proc:0x007f874d026008 (lambda)>
pr.call # => "foo"
//}... -
Proc
# lambda? -> bool (6299.0) -
手続きオブジェクトの引数の取扱が厳密であるならば true を返します。
...ruby]{
# lambda で生成した Proc オブジェクトでは true
lambda{}.lambda? # => true
# proc で生成した Proc オブジェクトでは false
proc{}.lambda? # => false
# Proc.new で生成した Proc オブジェクトでは false
Proc.new{}.lambda? # => false
# 以下、lambda?が偽......# lambdaの場合これらはすべて ArgumentError となる
# &が付いた仮引数で生成される Proc は lambda? が偽となる
def n(&b) b.lambda? end
n {} # => false
# &が付いた実引数によるものは、lambda?が元の Procオブジェクトから
# 引き継がれる
lambda......rue
Proc.new(&lambda {}).lambda? #=> true
lambda(&proc {}).lambda? #=> false
proc(&proc {}).lambda? #=> false
Proc.new(&proc {}).lambda? #=> false
n(&lambda {}) #=> true
n(&proc {}) #=> false
n(&Proc.new {}) #=> false
# Method#to_proc に... -
Kernel
. # proc { . . . } -> Proc (3151.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...します。
また、lambda に & 引数を渡すのは推奨されません。& 引数ではなくてブロック記法で記述する必要があります。
& 引数を渡した lambda は Warning[:deprecated] = true のときに警告メッセージ
「warning: lambda without a literal block......is deprecated; use the proc without lambda instead」
を出力します。
@raise ArgumentError ブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo &block
lambda(&block)
end
it = foo{p 12}
it.call #=> 12
//}
@see Proc,Proc.new
===[a:sh......合、lambda では手続きオブジェクト自身を抜けますが、
Proc.new では手続きオブジェクトを囲むメソッドを抜けます。
//emlist[例][ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end
def test_lambda
f = lambda { retu......is deprecated; use the proc without lambda instead」
を出力します。
@raise ArgumentError ブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo &block
proc(&block)
end
it = foo{p 12}
it.call #=> 12
//}
@see Proc,Proc.new
===[a:shou... -
手続きオブジェクトの挙動の詳細 (3136.0)
-
手続きオブジェクトの挙動の詳細 * def * should_use_next * block * lambda_proc * orphan
...手続きオブジェクトの挙動の詳細
* def
* should_use_next
* block
* lambda_proc
* orphan
===[a:def] 手続きオブジェクトとは
手続きオブジェクトとはブロックをコンテキスト(ローカル変数のスコープやスタックフレーム)と
ともにオ......//emlist[LocalJumpError が発生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}
===[a:lambda_proc] lambda と proc と Proc.new とイテレータの違い
Kernel.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生成し......合、lambda では手続きオブジェクト自身を抜けますが、
Proc.new では手続きオブジェクトを囲むメソッドを抜けます。
//emlist[例][ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end
def test_lambda
f = lambda { retu... -
Kernel
. # proc -> Proc (3134.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...のメソッドで指定されたブロック
を得たい場合は明示的に & 引数でうけるべきです。
ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
Argument......にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo &block
lambda(&block)
end
it = foo{p 12}
it.call #=> 12
//}
@see Proc,Proc.new
===[a:should_use_next] 手続きを中断して値を返す
手続きオブ......合、lambda では手続きオブジェクト自身を抜けますが、
Proc.new では手続きオブジェクトを囲むメソッドを抜けます。
//emlist[例][ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end
def test_lambda
f = lambda { retu... -
Kernel
. # proc { . . . } -> Proc (3134.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...のメソッドで指定されたブロック
を得たい場合は明示的に & 引数でうけるべきです。
ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
Argument......にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo &block
lambda(&block)
end
it = foo{p 12}
it.call #=> 12
//}
@see Proc,Proc.new
===[a:should_use_next] 手続きを中断して値を返す
手続きオブ......合、lambda では手続きオブジェクト自身を抜けますが、
Proc.new では手続きオブジェクトを囲むメソッドを抜けます。
//emlist[例][ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end
def test_lambda
f = lambda { retu... -
Kernel
. # proc -> Proc (3133.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...のメソッドで指定されたブロック
を得たい場合は明示的に & 引数でうけるべきです。
ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
Argument......にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo &block
lambda(&block)
end
it = foo{p 12}
it.call #=> 12
//}
@see Proc,Proc.new
===[a:should_use_next] 手続きを中断して値を返す
手続きオブ......合、lambda では手続きオブジェクト自身を抜けますが、
Proc.new では手続きオブジェクトを囲むメソッドを抜けます。
//emlist[例][ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end
def test_lambda
f = lambda { retu... -
Kernel
. # proc { . . . } -> Proc (3133.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...のメソッドで指定されたブロック
を得たい場合は明示的に & 引数でうけるべきです。
ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
Argument......にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo &block
lambda(&block)
end
it = foo{p 12}
it.call #=> 12
//}
@see Proc,Proc.new
===[a:should_use_next] 手続きを中断して値を返す
手続きオブ......合、lambda では手続きオブジェクト自身を抜けますが、
Proc.new では手続きオブジェクトを囲むメソッドを抜けます。
//emlist[例][ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end
def test_lambda
f = lambda { retu... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (222.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への変更点(まとめ)/サポートプラットフォームの追加>))
...2-09-21 の ChangeLog 参照。まじめにおっかけるのに疲れたらしい
^^;;)
: ((<Proc/Proc.new>)) [change]
: ((<組み込み関数/lambda>)) [change]
: ((<組み込み関数/proc>)) [change]
以下のように変更されました。((<ruby-dev:20358>))
* Proc.new お......from -:1
ruby 1.8.0 (2003-06-21) [i586-linux]
* lambda および proc が返す Proc は引数チェックが厳しい。
break は実行を中断する。
lambda {|a,b,c| p [a,b,c]}.call(1,2)
=> -:1: wrong # of arguments (2 for......ことを意味する
ようになります。((<ruby-dev:20358>))
: defined? [compat]
属性代入、配列要素への代入に対して "method" でなく "assignment" を返
すようになりました。
: ((<リテラル/数値リテラル>)) [compat]
10進((*整数*))リテラル... -
PP
# seplist(list , sep = lambda { comma _ breakable } , iter _ method = :each) {|e| . . . } -> () (220.0) -
リストの各要素を何かで区切りつつ、自身に追加していくために使われます。
...リストの各要素を何かで区切りつつ、自身に追加していくために使われます。
list を iter_method によってイテレートし、各要素を引数としてブロックを実行します。
また、それぞれのブロックの実行の合間に sep が呼ばれま......。iter_method を適切に指定すれば、
Enumerable でなくても構いません。
@param sep 区切りを自身に追加するブロックを与えます。list がイテレートされないなら、
sep は決して呼ばれません。
@param iter_method list を... -
Proc
# parameters(lambda: nil) -> [object] (161.0) -
Proc オブジェクトの引数の情報を返します。
...k
& で指定されたブロック引数
@param lambda true なら lambda として扱ったとき、false なら lambda ではない Proc として
扱ったときの引数の情報を返します。
//emlist[例][ruby]{
prc = lambda{|x, y=42, *other, k_x:, k_y: 42, **k_other, &b|}......[: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], [:opt, :y......], [:rest, :other
prc = lambda{|x, y=42, *other|}
p prc.parameters(lambda: false) # => x], [:opt, :y], [:rest, :other
//}
@see Method#parameters, UnboundMethod#parameters...