るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

検索結果

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

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

...の結果をペアとして使います。

//emlist[例][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] }
# => {"count...

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

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

...の結果をペアとして使います。

//emlist[例][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] }
# => {"count...

JSON::State#to_h -> Hash (18120.0)

自身をハッシュに変換します。

...自身をハッシュに変換します。

//emlist[例][ruby]{
require
"json"
require
"pp"

json_state = JSON::State.new
pp json_state.to_h

# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,...

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

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

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


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

JSON::State#to_hash -> Hash (6120.0)

自身をハッシュに変換します。

...自身をハッシュに変換します。

//emlist[例][ruby]{
require
"json"
require
"pp"

json_state = JSON::State.new
pp json_state.to_h

# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,...

絞り込み条件を変える

CSV::Row#to_hash -> Hash (6107.0)

自身をシンプルなハッシュに変換します。

...プルなハッシュに変換します。

フィールドの順序は無視されます。
重複したフィールドは削除されます。

//emlist[例][ruby]{
require
"csv"

row = CSV::Row.new(["header2", "header1", "header2"], [1, 2, 3])
row.to_hash # => {"header2"=>3, "header1"=>2}
//}...

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"}...

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"}...