7件ヒット
[1-7件を表示]
(0.119秒)
クラス
-
CSV
:: Row (1) - DBM (1)
-
JSON
:: State (2) - SDBM (3)
検索結果
先頭5件
-
CSV
:: Row # to _ hash -> Hash (54343.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 (54343.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 (54343.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"} -
JSON
:: State # to _ hash -> Hash (45343.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,
# :max_nesting=>100,
# ... -
SDBM
# replace(other) -> self (76.0) -
self の内容を other の内容で置き換えます。
self の内容を other の内容で置き換えます。
@param other each_pair メソッドを持つオブジェクトでなければなりません。
require 'sdbm'
db1 = SDBM.open('aaa.gdbm', 0666)
db1['a'] = 'aaa'
db1['b'] = 'bbb'
db1['c'] = 'ccc'
db2 = SDBM.open('bbb.gdbm', 0666)
db2['c'] = 'ccc'
db2['d'] = 'ddd'
hash = { 'x' => 'xxx', 'y' => 'y... -
SDBM
# update(other) -> self (76.0) -
self と other の内容をマージします。
self と other の内容をマージします。
重複するキーに対応する値はother の内容で上書きされます。
@param other each_pair メソッドを持つオブジェクトでなければなりません。
require 'sdbm'
db1 = SDBM.open('aaa.gdbm', 0666)
db1.clear
db1['a'] = 'aaa'
db1['b'] = 'bbb'
db1['c'] = 'ccc'
db2 = SDBM.open('bbb.gdbm', 0666)
db2.clear
db2['c'] = 'ccc'... -
JSON
:: State # to _ h -> Hash (43.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,
# :max_nesting=>100,
# ...