るりまサーチ

最速Rubyリファレンスマニュアル検索!
453件ヒット [201-300件を表示] (0.074秒)

別のキーワード

  1. _builtin sort
  2. array sort
  3. array sort!
  4. _builtin sort!
  5. array sort_by!

ライブラリ

クラス

モジュール

検索結果

<< < 1 2 3 4 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...

絞り込み条件を変える

<< < 1 2 3 4 5 > >>