{"author_name":"kwatch","blog_title":"k\u306a\u3093\u3068\u304b\u306e\u65e5\u8a18","width":"100%","version":"1.0","height":"190","url":"https://kwatch.hatenadiary.org/entry/20080609/1213029122","published":"2008-06-09 01:32:02","image_url":null,"categories":["ruby"],"author_url":"https://blog.hatena.ne.jp/kwatch/","description":"class ERB def result_hash(hash) b = binding hash.each {|k,v| eval \"#{k} = %Q[#{v}]\", b} result b end end puts ERB.new('<%= example %>').result_hash(:example => 'foo') ERB \u3067\u5f15\u6570\u306e hash \u3092\u5c55\u958b\u3057\u3066\u6b32\u3057\u3044 - #\u751f\u5b58\u6226\u7565 \u3001\u305d\u308c\u306f - subtech \u3053\u308c\u3060\u3068\u3001\u5024\u304cArray\u3068\u304b\u3060\u3063\u305f\u3089\u3046\u307e\u304f\u3044\u304b\u306a\u3044\u3002\u307e\u305f\u7e70\u308a\u8fd4\u3057\u3054\u3068\u306beval\u3059\u308b\u306e\u306f\u52b9\u7387\u304c\u60aa\u3044\u3002\u3053\u3046\u66f8\u304d\u63db\u3048\u305f\u307b\u3046\u304c\u3044\u3044\u3060\u308d\u3046\u3002 class ERB def result_\u2026","provider_name":"Hatena Blog","type":"rich","provider_url":"https://hatena.blog","blog_url":"https://kwatch.hatenadiary.org/","title":" ERB \u3067 Binding \u306e\u304b\u308f\u308a\u306b Hash \u3092\u4f7f\u3046","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkwatch.hatenadiary.org%2Fentry%2F20080609%2F1213029122\" title=\" ERB \u3067 Binding \u306e\u304b\u308f\u308a\u306b Hash \u3092\u4f7f\u3046 - k\u306a\u3093\u3068\u304b\u306e\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>"}