관리-도구
편집 파일: default%3d-i.yaml
--- !ruby/object:RI::MethodDescription aliases: [] block_params: comment: - !ruby/struct:SM::Flow::P body: Sets the default value, the value returned for a key that does not exist in the hash. It is not possible to set the a default to a <tt>Proc</tt> that will be executed on each key lookup. - !ruby/struct:SM::Flow::VERB body: " h = { "a" => 100, "b" => 200 }\n h.default = "Go fish"\n h["a"] #=> 100\n h["z"] #=> "Go fish"\n # This doesn't do what you might hope...\n h.default = proc do |hash, key|\n hash[key] = key + key\n end\n h[2] #=> #<Proc:0x401b3948@-:6>\n h["cat"] #=> #<Proc:0x401b3948@-:6>\n" full_name: Hash#default= is_singleton: false name: default= params: | hsh.default = obj => hsh visibility: public