ライブラリ
- ビルトイン (100)
- openssl (11)
- pp (11)
- prettyprint (22)
- tsort (85)
クラス
-
OpenSSL
:: SSL :: SSLContext (11) - PP (11)
- PrettyPrint (22)
- Proc (35)
- Symbol (3)
- Thread (11)
キーワード
- [] (5)
- call (11)
-
each
_ strongly _ connected _ component (21) -
each
_ strongly _ connected _ component _ from (21) - format (11)
- irb (11)
- lambda? (11)
- parameters (2)
- proc (18)
-
rb
_ f _ lambda (11) -
renegotiation
_ cb= (11) - seplist (11)
-
set
_ trace _ func (22) -
singleline
_ format (11) -
strongly
_ connected _ components (11) -
to
_ proc (3) - tsort (11)
-
tsort
_ each (21) - yield (11)
- メソッド呼び出し(super・ブロック付き・yield) (11)
- 手続きオブジェクトの挙動の詳細 (11)
検索結果
先頭5件
-
Kernel
. # lambda { . . . } -> Proc (24327.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...また、lambda に & 引数を渡すのは推奨されません。& 引数ではなくてブロック記法で記述する必要があります。
& 引数を渡した lambda は Warning[:deprecated] = true のときに警告メッセージ
「warning: lambda without a literal block is deprecat......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:should_use_next] 手......では yield、それ以外では Proc#call)
へジャンプし値を返すには next を使います。break や return ではありません。
//emlist[例][ruby]{
def foo
f = Proc.new{
next 1
2 # この行に到達することはない
}
end
p foo().call #=> 1......e 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:should_use_next] 手... -
Kernel
. # lambda -> Proc (24310.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...るべきです。
ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。
ブロックを指定......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 スタック上にブロッ....../emlist[例][ruby]{
def foo &block
lambda(&block)
end
it = foo{p 12}
it.call #=> 12
//}
@see Proc,Proc.new
===[a:should_use_next] 手続きを中断して値を返す
手続きオブジェクトを中断して、呼出し元(呼び出しブロックでは yield、それ以外では Proc#call)... -
Kernel
. # lambda { . . . } -> Proc (24310.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...るべきです。
ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。
ブロックを指定......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 スタック上にブロッ....../emlist[例][ruby]{
def foo &block
lambda(&block)
end
it = foo{p 12}
it.call #=> 12
//}
@see Proc,Proc.new
===[a:should_use_next] 手続きを中断して値を返す
手続きオブジェクトを中断して、呼出し元(呼び出しブロックでは yield、それ以外では Proc#call)... -
Proc
# lambda? -> bool (12357.0) -
手続きオブジェクトの引数の取扱が厳密であるならば true を返します。
...mlist[例][ruby]{
# lambda で生成した Proc オブジェクトでは true
lambda{}.lambda? # => true
# proc で生成した Proc オブジェクトでは false
proc{}.lambda? # => false
# Proc.new で生成した Proc オブジェクトでは false
Proc.new{}.lambda? # => false
# 以下、la......# 余分な引数を無視する
proc{|a,b| [a,b]}.call(1,2,3) # => [1,2]
# 足りない引数には nil が渡される
proc{|a,b| [a,b]}.call(1) # => [1, nil]
# 配列1つだと展開される
proc{|a,b| [a,b]}.call([1,2]) # => [1,2]
# lambdaの場合これらはすべて ArgumentError となる......) b.lambda? end
n {} # => false
# &が付いた実引数によるものは、lambda?が元の Procオブジェクトから
# 引き継がれる
lambda(&lambda {}).lambda? #=> true
proc(&lambda {}).lambda? #=> true
Proc.new(&lambda {}).lambda? #=> true
lambda(&proc {}).lambda? #=> false
p... -
VALUE rb
_ f _ lambda(void) (12200.0) -
ruby_block 先端の BLOCK から Proc オブジェクトを作成し、返します。
...ruby_block 先端の BLOCK から Proc オブジェクトを作成し、返します。... -
PP
# seplist(list , sep = lambda { comma _ breakable } , iter _ method = :each) {|e| . . . } -> () (6301.0) -
リストの各要素を何かで区切りつつ、自身に追加していくために使われます。
...れます。
list を iter_method によってイテレートし、各要素を引数としてブロックを実行します。
また、それぞれのブロックの実行の合間に sep が呼ばれます。
つまり、以下のふたつは同値です。
//emlist[][ruby]{
q.seplist([1,2,3])......omma_breakable
q.pp 2
q.comma_breakable
q.pp 3
//}
@param list 自身に追加したい配列を与えます。iter_method を適切に指定すれば、
Enumerable でなくても構いません。
@param sep 区切りを自身に追加するブロックを与えます。list がイ......テレートされないなら、
sep は決して呼ばれません。
@param iter_method list をイテレートするメソッドをシンボルで与えます。
@see PP#comma_breakable... -
PrettyPrint
. singleline _ format(output = & # 39;& # 39; , maxwidth = 79 , newline = "\n" , genspace = lambda{|n| & # 39; & # 39; * n}) {|pp| . . . } -> object (6201.0) -
PrettyPrint オブジェクトを生成し、それを引数としてブロックを実行します。 PrettyPrint.format に似ていますが、改行しません。
...ックを実行します。
PrettyPrint.format に似ていますが、改行しません。
引数 maxwidth, newline と genspace は無視されます。ブロック中の breakable の実行は、
改行せずに text の実行であるかのように扱います。
@param output 出力先を......指定します。output は << メソッドを持っていなければなりません。
@param maxwidth 無視されます。
@param newline 無視されます。
@param genspace 無視されます。... -
Kernel
. # proc { . . . } -> Proc (6127.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...また、lambda に & 引数を渡すのは推奨されません。& 引数ではなくてブロック記法で記述する必要があります。
& 引数を渡した lambda は Warning[:deprecated] = true のときに警告メッセージ
「warning: lambda without a literal block is deprecat......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:should_use_next] 手......では yield、それ以外では Proc#call)
へジャンプし値を返すには next を使います。break や return ではありません。
//emlist[例][ruby]{
def foo
f = Proc.new{
next 1
2 # この行に到達することはない
}
end
p foo().call #=> 1... -
TSort
. each _ strongly _ connected _ component(each _ node , each _ child) -> Enumerator (6124.0) -
TSort.strongly_connected_components メソッドのイテレータ版です。
...ngly_connected_components メソッドのイテレータ版です。
引数 each_node と each_child でグラフを表します。
@param each_node グラフ上の頂点をそれぞれ評価するcallメソッドを持つオブ
ジェクトを指定します。
@param each_child......価するcallメソッ
ドを持つオブジェクトを指定します。
//emlist[使用例][ruby]{
require 'tsort'
g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
TSort.each_strongly_connected_com......ponent(each_node, each_child) {|scc| p scc }
# => [4]
# [2]
# [3]
# [1]
g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
# => [4]
#... -
TSort
. each _ strongly _ connected _ component(each _ node , each _ child) {|nodes| . . . } -> nil (6124.0) -
TSort.strongly_connected_components メソッドのイテレータ版です。
...ngly_connected_components メソッドのイテレータ版です。
引数 each_node と each_child でグラフを表します。
@param each_node グラフ上の頂点をそれぞれ評価するcallメソッドを持つオブ
ジェクトを指定します。
@param each_child......価するcallメソッ
ドを持つオブジェクトを指定します。
//emlist[使用例][ruby]{
require 'tsort'
g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
TSort.each_strongly_connected_com......ponent(each_node, each_child) {|scc| p scc }
# => [4]
# [2]
# [3]
# [1]
g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
# => [4]
#... -
TSort
. strongly _ connected _ components(each _ node , each _ child) -> Array (6124.0) -
強連結成分の集まりを配列の配列として返します。 この配列は子から親に向かってソートされています。 各要素は強連結成分を表す配列です。
...ode と each_child でグラフを表します。
@param each_node グラフ上の頂点をそれぞれ評価するcallメソッドを持つオブ
ジェクトを指定します。
@param each_child 引数で与えられた頂点の子をそれぞれ評価するcallメソッ......ェクトを指定します。
//emlist[使用例][ruby]{
require 'tsort'
g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
p TSort.strongly_connected_components(each_node, each_child)
# => [[4], [2], [3], [1]]
g = {1=......>[2], 2=>[3, 4], 3=>[2], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
p TSort.strongly_connected_components(each_node, each_child)
# => [[4], [2, 3], [1]]
//}
@see TSort#strongly_connected_components... -
Kernel
. # proc { . . . } -> Proc (6121.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...また、lambda に & 引数を渡すのは推奨されません。& 引数ではなくてブロック記法で記述する必要があります。
& 引数を渡した lambda は Warning[:deprecated] = true のときに警告メッセージ
「warning: lambda without a literal block is deprecat......e 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:should_use_next] 手......では yield、それ以外では Proc#call)
へジャンプし値を返すには next を使います。break や return ではありません。
//emlist[例][ruby]{
def foo
f = Proc.new{
next 1
2 # この行に到達することはない
}
end
p foo().call #=> 1... -
手続きオブジェクトの挙動の詳細 (6112.0)
-
手続きオブジェクトの挙動の詳細 * def * should_use_next * block * lambda_proc * orphan
...手続きオブジェクトの挙動の詳細
* def
* should_use_next
* block
* lambda_proc
* orphan
===[a:def] 手続きオブジェクトとは
手続きオブジェクトとはブロックをコンテキスト(ローカル変数のスコープやスタックフレーム)と
ともにオ......//emlist[例][ruby]{
var = 1
$foo = Proc.new { var }
var = 2
def foo
$foo.call
end
p foo # => 2
//}
===[a:should_use_next] 手続きを中断して値を返す
手続きオブジェクトを中断して、呼出し元(呼び出しブロックでは yield、それ以外では Proc#call)......ext を使います。break や return ではありません。
//emlist[例][ruby]{
def foo
f = Proc.new{
next 1
2 # この行に到達することはない
}
end
p foo().call #=> 1
//}
===[a:block] Proc オブジェクトをブロック付きメソッド呼び出...