3件ヒット
[1-3件を表示]
(0.256秒)
検索結果
-
Hash
# to _ h -> self | Hash (78394.0) -
self を返します。Hash クラスのサブクラスから呼び出した場合は 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 (42337.0) -
self を返します。
self を返します。
//emlist[例][ruby]{
hash = {}
p hash.to_hash # => {}
p hash.to_hash == hash # => true
//}
@see Object#to_hash, Hash#to_h -
ENV
. clone(freeze: true) -> object (24340.0) -
ENV オブジェクトの複製を作成して返します。
ENV オブジェクトの複製を作成して返します。
ENV は OS のプロセス全体で共有される環境変数を操作するラッパーオブジェクトなので、複製は有用ではありません。
そのため、3.1 からは複製で環境変数を操作するときに deprecated 警告がでます。
テスト実行中に環境変数を退避する用途には ENV.to_h を使用してください。
//emlist[][ruby]{
saved_env = ENV.to_h
# (テストなど)
ENV.replace(saved_env)
//}
@see Object#clone