クラス
- Array (72)
-
Net
:: IMAP (24) - Numeric (12)
-
RSS
:: Maker :: ItemsBase (24)
モジュール
- Enumerable (204)
- TSort (117)
キーワード
- chunk (12)
-
do
_ sort (12) -
do
_ sort= (12) -
each
_ strongly _ connected _ component (23) -
each
_ strongly _ connected _ component _ from (23) -
max
_ by (48) -
min
_ by (48) - minmax (24)
-
minmax
_ by (24) - nonzero? (12)
- sort! (24)
-
sort
_ by (24) -
sort
_ by! (24) -
strongly
_ connected _ components (12) - tsort (12)
-
tsort
_ each (23) -
tsort
_ each _ child (12) -
tsort
_ each _ node (12) -
uid
_ sort (12)
検索結果
先頭5件
-
Array
# sort _ by! {|item| . . . } -> self (6131.0) -
sort_by の破壊的バージョンです。
...sort_by の破壊的バージョンです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
fruits = %w{apple pear fig}
fruits.sort_by! { |word| word.length }
fruits # => ["fig", "pear", "apple"]
//}
@see Enumerable#sort_by... -
RSS
:: Maker :: ItemsBase # do _ sort (6118.0) -
@todo 現在のdo_sortの値を取得します.デフォルトでは falseになっています.
...@todo
現在のdo_sortの値を取得します.デフォルトでは
falseになっています.... -
RSS
:: Maker :: ItemsBase # do _ sort=() (6102.0) -
@todo trueに設定するとitem.dateが新しい順に並び替 えます.Procオブジェクトを指定することにより並び 替え方法をカスタマイズすることができます.
@todo
trueに設定するとitem.dateが新しい順に並び替
えます.Procオブジェクトを指定することにより並び
替え方法をカスタマイズすることができます. -
TSort
# each _ strongly _ connected _ component _ from(node , id _ map={} , stack=[]) -> Enumerator (3019.0) -
node から到達可能な強連結成分についてのイテレータです。
...ngly_connected_component_from は
tsort_each_node を呼びません。
@param node ノードを指定します。
//emlist[例 到達可能なノードを表示する][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetc......h(node).each(&block)
end
end
non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
non_sort.each_strongly_connected_component{|nodes|
p nodes
nodes.each {|node|
non_sort.each_strongly_connected_component_from(node){|ns|
printf("%s -> %s\n", node, ns.join(","))
}
}
}
#出力
#=> [4]......#=> 4 -> 4
#=> [2, 3]
#=> 2 -> 4
#=> 2 -> 2,3
#=> 3 -> 4
#=> 3 -> 3,2
#=> [1]
#=> 1 -> 4
#=> 1 -> 2,3
#=> 1 -> 1
//}
@see TSort.each_strongly_connected_component_from... -
TSort
# each _ strongly _ connected _ component _ from(node , id _ map={} , stack=[]) {|nodes| . . . } -> () (3019.0) -
node から到達可能な強連結成分についてのイテレータです。
...ngly_connected_component_from は
tsort_each_node を呼びません。
@param node ノードを指定します。
//emlist[例 到達可能なノードを表示する][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetc......h(node).each(&block)
end
end
non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
non_sort.each_strongly_connected_component{|nodes|
p nodes
nodes.each {|node|
non_sort.each_strongly_connected_component_from(node){|ns|
printf("%s -> %s\n", node, ns.join(","))
}
}
}
#出力
#=> [4]......#=> 4 -> 4
#=> [2, 3]
#=> 2 -> 4
#=> 2 -> 2,3
#=> 3 -> 4
#=> 3 -> 3,2
#=> [1]
#=> 1 -> 4
#=> 1 -> 2,3
#=> 1 -> 1
//}
@see TSort.each_strongly_connected_component_from... -
TSort
# each _ strongly _ connected _ component -> Enumerator (3013.0) -
TSort#strongly_connected_components メソッドのイテレータ版です。 obj.each_strongly_connected_component は obj.strongly_connected_components.each に似ていますが、 ブロックの評価中に obj が変更された場合は予期しない結果になる ことがあります。
...TSort#strongly_connected_components メソッドのイテレータ版です。
obj.each_strongly_connected_component は
obj.strongly_connected_components.each に似ていますが、
ブロックの評価中に obj が変更された場合は予期しない結果になる
ことがあります。......します。
//emlist[使用例][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
non_sort.each_strongly_connected_component{|nodes|
p nod......es
}
#出力
#=> [4]
#=> [2, 3]
#=> [1]
//}
@see TSort.each_strongly_connected_component... -
TSort
# each _ strongly _ connected _ component {|nodes| . . . } -> nil (3013.0) -
TSort#strongly_connected_components メソッドのイテレータ版です。 obj.each_strongly_connected_component は obj.strongly_connected_components.each に似ていますが、 ブロックの評価中に obj が変更された場合は予期しない結果になる ことがあります。
...TSort#strongly_connected_components メソッドのイテレータ版です。
obj.each_strongly_connected_component は
obj.strongly_connected_components.each に似ていますが、
ブロックの評価中に obj が変更された場合は予期しない結果になる
ことがあります。......します。
//emlist[使用例][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
non_sort.each_strongly_connected_component{|nodes|
p nod......es
}
#出力
#=> [4]
#=> [2, 3]
#=> [1]
//}
@see TSort.each_strongly_connected_component... -
TSort
# strongly _ connected _ components -> Array (3013.0) -
強連結成分の集まりを配列の配列として返します。 この配列は子から親に向かってソートされています。 各要素は強連結成分を表す配列です。
...by]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
p non_sort.strongly_connected_components
#=> [[4], [2, 3], [1]]
//}
@see TSort.strongly_conne... -
Enumerable
# minmax _ by -> Enumerator (25.0) -
Enumerable オブジェクトの各要素をブロックに渡して評価し、その結果を <=> で比較して 最小の要素と最大の要素を要素とするサイズ 2 の配列を返します。
...する場合、どの要素を返すかは不定です。
Enumerable#minmax と Enumerable#minmax_by の
違いは sort と sort_by の違いと同じです。
詳細は Enumerable#sort_by を参照してください。
//emlist[例][ruby]{
a = %w(albatross dog horse)
a.minmax_by {|x| x.length }......#=> ["dog", "albatross"]
[].minmax_by{} # => [nil, nil]
//}
ブロックを省略した場合は Enumerator を返します。
@see Enumerable#sort_by... -
Enumerable
# minmax _ by {|obj| . . . } -> [object , object] (25.0) -
Enumerable オブジェクトの各要素をブロックに渡して評価し、その結果を <=> で比較して 最小の要素と最大の要素を要素とするサイズ 2 の配列を返します。
...する場合、どの要素を返すかは不定です。
Enumerable#minmax と Enumerable#minmax_by の
違いは sort と sort_by の違いと同じです。
詳細は Enumerable#sort_by を参照してください。
//emlist[例][ruby]{
a = %w(albatross dog horse)
a.minmax_by {|x| x.length }......#=> ["dog", "albatross"]
[].minmax_by{} # => [nil, nil]
//}
ブロックを省略した場合は Enumerator を返します。
@see Enumerable#sort_by...