{"published":"2018-05-17 02:06:01","type":"rich","author_name":"te-nu","categories":["Ruby"],"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.te-nu.com%2Fentry%2F2018%2F05%2F17%2F020601\" title=\"immutable\u306a\u30af\u30e9\u30b9\u3067to_hash\u3092\u4f5c\u308b\u307e\u3067 - \u30a6\u30a7\u30d6\u30a8\u30f3\u30b8\u30cb\u30a2\u73cd\u9053\u4e2d\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","width":"100%","author_url":"https://blog.hatena.ne.jp/te-nu/","description":"Ruby\u306b\u3066\u30bb\u30c3\u30bf\u3092\u3082\u305f\u306a\u3044immutable\u306a\u30af\u30e9\u30b9\u3092\u4f5c\u308a\u3001to_hash\u3067\u5024\u3092\u53d6\u3063\u3066\u304f\u308b\u3088\u3046\u306b\u3057\u305f\u306e\u3067\u307e\u3068\u3081\u307e\u3059\u3002 \u4eca\u56de\u306f\u4f8b\u3068\u3057\u3066\u672c\uff08Book\uff09\u30af\u30e9\u30b9\u3092\u4f5c\u308a\u307e\u3059\u3002 \u5b8c\u6210\u54c1 class Book ATTRIBUTE_NAMES = [:name, :author, :price].freeze attr_reader *ATTRIBUTE_NAMES def initialize(name, author, price) @name = name @author = author @price = price end def to_hash ATTRIBUTE_NAMES.inject({}\u2026","blog_title":"\u30a6\u30a7\u30d6\u30a8\u30f3\u30b8\u30cb\u30a2\u73cd\u9053\u4e2d","url":"https://www.te-nu.com/entry/2018/05/17/020601","title":"immutable\u306a\u30af\u30e9\u30b9\u3067to_hash\u3092\u4f5c\u308b\u307e\u3067","provider_name":"Hatena Blog","provider_url":"https://hatena.blog","blog_url":"https://www.te-nu.com/","image_url":"https://cdn.user.blog.st-hatena.com/default_entry_og_image/106103785/1514249265436207","version":"1.0","height":"190"}