るりまサーチ

最速Rubyリファレンスマニュアル検索!
137件ヒット [1-100件を表示] (0.116秒)

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

OpenStruct#to_h -> { Symbol => object } (21115.0)

self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返 します。

...t[例][ruby]{
require 'ostruct'
data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
data.to_h # => {:country => "Australia", :capital => "Canberra" }
data.to_h {|name, value| [name.to_s, value.upcase] }
# => {"country" => "AUSTRALIA", "capital" => "CANBERRA" }
//}...

OpenStruct#to_h {|name, value| block } -> Hash (21115.0)

self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返 します。

...t[例][ruby]{
require 'ostruct'
data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
data.to_h # => {:country => "Australia", :capital => "Canberra" }
data.to_h {|name, value| [name.to_s, value.upcase] }
# => {"country" => "AUSTRALIA", "capital" => "CANBERRA" }
//}...

OpenStruct#to_h -> { Symbol => object } (21108.0)

self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返 します。

...self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返
します。


//emlist[例][ruby]{
require 'ostruct'
data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
data.to_h # => {:country => "Australia", :capital => "Canberra" }
//}...

OpenSSL::X509::Extension#to_h -> Hash (21102.0)

拡張領域の内容を、 { "oid" => 識別子(extnID), "value" => 値(extnValue), "critical" => 重要度(critical) } というハッシュで返します。

拡張領域の内容を、
{ "oid" => 識別子(extnID), "value" => 値(extnValue), "critical" => 重要度(critical) }
というハッシュで返します。

Hash#to_h -> self | Hash (18163.0)

self を返します。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.class # => 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 (18163.0)

self を返します。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.class # => 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 -> self | Hash (18156.0)

self を返します。Hash クラスのサブクラスから呼び出した場合は self を 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.class # => MyHash
p
my_hash.to_h.class # => Hash
//}...

Hash#to_hash -> self (6119.0)

self を返します。

...self を返します。

//emlist[例][ruby]{
hash = {}
p
hash.to_hash # => {}
p
hash.to_hash == hash # => true
//}

@see Object#to_hash, Hash#to_h...

DBM#to_hash -> Hash (6107.0)

self をハッシュに変換して返します。

...self をハッシュに変換して返します。

require 'dbm'

db1 = DBM.open('aaa.db', 0666, DBM::NEWDB)
db1[:a] = 'aaa'
db1[:b] = 'bbbbbb'
p
db1.to_hash #=> {"a"=>"aaa", "b"=>"bbbbbb"}...

Object#to_hash -> Hash (6107.0)

オブジェクトの Hash への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。

...すべての場面で代置可能であるような、
* ハッシュそのものとみなせるようなもの
という厳しいものになっています。

//emlist[][ruby]{
class Foo
def to_hash
{'as' => 24}
end
end

it = Foo.new
p
({:as => 12}.merge(it)) #=> {"as"=>24, :as=>12}
//}...

絞り込み条件を変える

SDBM#to_hash -> Hash (6107.0)

self の各要素を格納したハッシュを返します。

...self の各要素を格納したハッシュを返します。

require 'sdbm'

db1 = SDBM.open('aaa.gdbm', 0666)
db1.clear
db1['a'] = 'aaa'
db1['b'] = 'bbb'
db1['c'] = 'ccc'

p
db1.to_hash #=> {"a"=>"aaa", "b"=>"bbb", "c"=>"ccc"}...

Enumerable#map -> Enumerator (3119.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] (3119.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...
<< 1 2 > >>