別のキーワード
種類
- インスタンスメソッド (336)
- 特異メソッド (50)
- モジュール関数 (33)
- 文書 (16)
- ライブラリ (11)
クラス
- Array (24)
- Encoding (11)
- Enumerator (7)
-
Enumerator
:: Lazy (44) - Exception (11)
- Hash (21)
- IO (11)
- Matrix (70)
- Object (44)
-
Rake
:: FileList (11) -
Thread
:: Backtrace :: Location (44)
モジュール
- Benchmark (11)
- Enumerable (46)
- Kernel (22)
- TSort (42)
キーワード
- == (11)
-
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 2
. 7 . 0 (5) - Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (5)
-
absolute
_ path (11) -
base
_ label (11) - binwrite (11)
- bmbm (11)
-
caller
_ locations (22) -
chunk
_ while (11) - collect (36)
- collect! (12)
- each (22)
-
each
_ strongly _ connected _ component _ from (42) -
enum
_ for (44) - inspect (11)
-
locale
_ charmap (11) - map! (12)
- new (7)
- pathmap (11)
- rake (11)
-
slice
_ when (11) -
to
_ enum (44) -
to
_ h (12) -
to
_ proc (9) -
to
_ s (11)
検索結果
先頭5件
-
Matrix
# map(which = :all) -> Enumerator (15326.0) -
行列の各要素に対してブロックの適用を繰り返した結果を、要素として持つ行列を生成します。
...ます。
@param which which に以下の Symbol を指定することで、
引数として使われる要素を限定できます。
デフォルトは、:all (全ての要素)です。
指定できる Symbol の詳細は、 Matrix#each の項目を参......照して下さい。
//emlist[例][ruby]{
require 'matrix'
m = Matrix[[1, 2], [3, 4]]
p m.map { |x| x + 100 } # => Matrix[[101, 102], [103, 104]]
p m.map(:diagonal) { |x| x * 10 } # => Matrix[[10, 2], [3, 40]]
//}
@see Matrix#each, Matrix#map!... -
Matrix
# map(which = :all) {|x| . . . } -> Matrix (15326.0) -
行列の各要素に対してブロックの適用を繰り返した結果を、要素として持つ行列を生成します。
...ます。
@param which which に以下の Symbol を指定することで、
引数として使われる要素を限定できます。
デフォルトは、:all (全ての要素)です。
指定できる Symbol の詳細は、 Matrix#each の項目を参......照して下さい。
//emlist[例][ruby]{
require 'matrix'
m = Matrix[[1, 2], [3, 4]]
p m.map { |x| x + 100 } # => Matrix[[101, 102], [103, 104]]
p m.map(:diagonal) { |x| x * 10 } # => Matrix[[10, 2], [3, 40]]
//}
@see Matrix#each, Matrix#map!... -
Array
# map -> Enumerator (15226.0) -
各要素に対してブロックを評価した結果を全て含む配列を返します。
...してブロックを評価した結果を全て含む配列を返します。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
# すべて 3 倍にする
p [1, 2, 3].map {|n| n * 3 } # => [3, 6, 9]
//}
@see Hash#to_h, Enumerable#collect, Enumerable#map... -
Array
# map {|item| . . . } -> [object] (15226.0) -
各要素に対してブロックを評価した結果を全て含む配列を返します。
...してブロックを評価した結果を全て含む配列を返します。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
# すべて 3 倍にする
p [1, 2, 3].map {|n| n * 3 } # => [3, 6, 9]
//}
@see Hash#to_h, Enumerable#collect, Enumerable#map... -
Enumerable
# map -> Enumerator (15226.0) -
各要素に対してブロックを評価した結果を全て含む配列を返します。
...配列を返します。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
# すべて 3 倍にした配列を返す
p (1..3).map {|n| n * 3 } # => [3, 6, 9]
p (1..3).collect { "cat" } # => ["cat", "cat", "cat"]
//}
@see Hash#to_h, Array#collect, Array#map... -
Enumerable
# map {|item| . . . } -> [object] (15226.0) -
各要素に対してブロックを評価した結果を全て含む配列を返します。
...配列を返します。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
# すべて 3 倍にした配列を返す
p (1..3).map {|n| n * 3 } # => [3, 6, 9]
p (1..3).collect { "cat" } # => ["cat", "cat", "cat"]
//}
@see Hash#to_h, Array#collect, Array#map... -
Encoding
. locale _ charmap -> String | nil (12342.0) -
ロケールエンコーディングを決定するために用いる、locale charmap 名を返します。nl_langinfo 等がない環境では nil を、miniruby では ASCII_8BIT を返します。
...locale charmap 名を返します。nl_langinfo 等がない環境では nil を、miniruby では ASCII_8BIT を返します。
//emlist[Debian GNU/Linux + LANG=C][ruby]{
Encoding.locale_charmap #=> "ANSI_X3.4-1968"
//}
//emlist[LANG=ja_JP.EUC-JP][ruby]{
Encoding.locale_charmap #=> "EUC-JP"
//}......//emlist[SunOS 5 + LANG=C][ruby]{
Encoding.locale_charmap #=> "646"
//}
//emlist[SunOS 5 + LANG=ja][ruby]{
Encoding.locale_charmap #=> "eucJP"
//}
@see charmap(5)... -
Rake
:: FileList # pathmap(spec = nil) -> Rake :: FileList (12306.0) -
各要素に String#pathmap を適用した新しい Rake::FileList を返します。
...各要素に String#pathmap を適用した新しい Rake::FileList を返します。
//emlist[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do
file_list = FileList.new("test1.rb", "test2.rb", "test3.rb")
file_list.pathmap("%n") # => ["test1", "......test2", "test3"]
end
//}
@see String#pathmap... -
TSort
. each _ strongly _ connected _ component _ from(node , each _ child , id _ map={} , stack=[]) -> Enumerator (6408.0) -
node から到達可能な強連結成分についてのイテレータです。
...e と each_child でグラフを表します。
返す値は規定されていません。
TSort.each_strongly_connected_component_fromはTSortをincludeして
グラフを表現する必要のないクラスメソッドです。
@param node ノードを指定します。
@param each_child 引......す。
//emlist[使用例][ruby]{
require 'tsort'
graph = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
each_child = lambda {|n, &b| graph[n].each(&b) }
TSort.each_strongly_connected_component_from(1, each_child) {|scc|
p scc
}
# => [4]
# [2, 3]
# [1]
//}
@see TSort#each_strongly_connected_component... -
TSort
. each _ strongly _ connected _ component _ from(node , each _ child , id _ map={} , stack=[]) {|nodes| . . . } -> () (6408.0) -
node から到達可能な強連結成分についてのイテレータです。
...e と each_child でグラフを表します。
返す値は規定されていません。
TSort.each_strongly_connected_component_fromはTSortをincludeして
グラフを表現する必要のないクラスメソッドです。
@param node ノードを指定します。
@param each_child 引......す。
//emlist[使用例][ruby]{
require 'tsort'
graph = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
each_child = lambda {|n, &b| graph[n].each(&b) }
TSort.each_strongly_connected_component_from(1, each_child) {|scc|
p scc
}
# => [4]
# [2, 3]
# [1]
//}
@see TSort#each_strongly_connected_component... -
Hash
# to _ h -> self | Hash (6356.0) -
self を返します。Hash クラスのサブクラスから呼び出した場合は self を Hash オブジェクトに変換します。
...す。Hash クラスのサブクラスから呼び出した場合は
self を Hash オブジェクトに変換します。
//emlist[例][ruby]{
hash = {}
p hash.to_h # => {}
p hash.to_h == hash # => true
class MyHash < Hash;end
my_hash = MyHash.new
p my_hash.to_h # => {}
p my_hash.clas......# => MyHash
p my_hash.to_h.class # => Hash
//}
ブロックを指定すると各ペアでブロックを呼び出し、
その結果をペアとして使います。
//emlist[ブロック付きの例][ruby]{
hash = { "a" => 97, "b" => 98 }
hash.to_h {|key, value| [key.upcase, value-32] } # =>......{"A"=>65, "B"=>66}
//}
@see Enumerable#map... -
Hash
# to _ h {|key , value| block } -> Hash (6356.0) -
self を返します。Hash クラスのサブクラスから呼び出した場合は self を Hash オブジェクトに変換します。
...す。Hash クラスのサブクラスから呼び出した場合は
self を Hash オブジェクトに変換します。
//emlist[例][ruby]{
hash = {}
p hash.to_h # => {}
p hash.to_h == hash # => true
class MyHash < Hash;end
my_hash = MyHash.new
p my_hash.to_h # => {}
p my_hash.clas......# => MyHash
p my_hash.to_h.class # => Hash
//}
ブロックを指定すると各ペアでブロックを呼び出し、
その結果をペアとして使います。
//emlist[ブロック付きの例][ruby]{
hash = { "a" => 97, "b" => 98 }
hash.to_h {|key, value| [key.upcase, value-32] } # =>......{"A"=>65, "B"=>66}
//}
@see Enumerable#map... -
TSort
# each _ strongly _ connected _ component _ from(node , id _ map={} , stack=[]) -> Enumerator (6308.0) -
node から到達可能な強連結成分についてのイテレータです。
...。
each_strongly_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, &b......lock)
fetch(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...