{"version":"1.0","categories":["ruby"],"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fjavascripter.hatenablog.com%2Fentry%2F20081116%2F1226783087\" title=\"Hash#method_missing - \u7d20\u4eba\u304c\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u52c9\u5f37\u3057\u3066\u3044\u305f\u30d6\u30ed\u30b0\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","url":"https://javascripter.hatenablog.com/entry/20081116/1226783087","description":"h['hoge']\u306f\u3061\u3087\u3063\u3068\u9577\u3044\u306a\u3068\u601d\u3063\u3066\u3001JavaScript\u307f\u305f\u3044\u306b\u3001\u30ad\u30fc\u304c\u5358\u7d14\u306a\u5834\u5408\u306fh.hoge\u3084h.hoge = :val\u306e\u3088\u3046\u306b\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u305f\u3002 class Hash def method_missing(name, val=nil) if name[-1] == '=' self[name.to_s[0..-2].to_sym] = val else self[name] end end end h = {} h.hoge = 1 p h # => {:hoge=>1} p h.hoge # => 1 \u3067\u3082\u3001\u5b9f\u969b\u4f7f\u3063\u3066\u307f\u308b\u3068\u3001\u305d\u3093\u306a\u306b\u4fbf\u5229\u3058\u3083\u306a\u3044\u3002","width":"100%","published":"2008-11-16 06:04:47","type":"rich","image_url":null,"author_name":"javascripter","blog_url":"https://javascripter.hatenablog.com/","provider_name":"Hatena Blog","blog_title":"\u7d20\u4eba\u304c\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u52c9\u5f37\u3057\u3066\u3044\u305f\u30d6\u30ed\u30b0","author_url":"https://blog.hatena.ne.jp/javascripter/","provider_url":"https://hatena.blog","height":"190","title":"Hash#method_missing"}