127件ヒット
[1-100件を表示]
(0.110秒)
モジュール
- Enumerable (28)
- TSort (23)
キーワード
- collect (28)
-
each
_ strongly _ connected _ component _ from (23) - starttls (24)
-
to
_ h (14) -
to
_ proc (10)
検索結果
先頭5件
-
Hash
# to _ h -> self | Hash (21213.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......s # => 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 (21213.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......s # => 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 _ proc -> Proc (21007.0) -
self のキーに対応する値を返す Proc オブジェクトを返します。
...self のキーに対応する値を返す Proc オブジェクトを返します。
//emlist[][ruby]{
h = {1 => 10, 2 => 20, 3 => 30}
[1, 2, 3].map(&h) # => [10, 20, 30]
//}... -
Array
# map -> Enumerator (15121.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] (15121.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 (15121.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] (15121.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... -
Net
:: IMAP # starttls(certs , verify) -> Net :: IMAP :: TaggedResponse (3107.0) -
STARTTLS コマンドを送って TLS のセッションを開始します。
...のファイル名(文字列)、
verify で検証するかどうか(Net::IMAP::VERIFY_PEER、
Net::IMAP::VERIFY_NONEに対応します)を
指定することができます。
@param options SSL/TLS のオプション(Hash オブジェクト)
@param certs 証明書ファイル名、もしくは証... -
Net
:: IMAP # starttls(options) -> Net :: IMAP :: TaggedResponse (3107.0) -
STARTTLS コマンドを送って TLS のセッションを開始します。
...のファイル名(文字列)、
verify で検証するかどうか(Net::IMAP::VERIFY_PEER、
Net::IMAP::VERIFY_NONEに対応します)を
指定することができます。
@param options SSL/TLS のオプション(Hash オブジェクト)
@param certs 証明書ファイル名、もしくは証... -
TSort
# each _ strongly _ connected _ component _ from(node , id _ map={} , stack=[]) -> Enumerator (109.0) -
node から到達可能な強連結成分についてのイテレータです。
...呼びません。
@param node ノードを指定します。
//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... -
TSort
# each _ strongly _ connected _ component _ from(node , id _ map={} , stack=[]) {|nodes| . . . } -> () (109.0) -
node から到達可能な強連結成分についてのイテレータです。
...呼びません。
@param node ノードを指定します。
//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... -
Array
# collect -> Enumerator (21.0) -
各要素に対してブロックを評価した結果を全て含む配列を返します。
...してブロックを評価した結果を全て含む配列を返します。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
# すべて 3 倍にする
p [1, 2, 3].map {|n| n * 3 } # => [3, 6, 9]
//}
@see Hash#to_h, Enumerable#collect, Enumerable#map...