{"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fganmacs.hatenablog.com%2Fentry%2F2015%2F07%2F31%2F083029\" title=\"Ruby\u306eStruct\u306e\u7c21\u6613\u7248\u5b9f\u88c5\u3057\u3066\u307f\u305f - memo-mode\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","categories":["Ruby"],"author_url":"https://blog.hatena.ne.jp/ganmacs/","image_url":null,"provider_name":"Hatena Blog","type":"rich","blog_title":"memo-mode","width":"100%","version":"1.0","title":"Ruby\u306eStruct\u306e\u7c21\u6613\u7248\u5b9f\u88c5\u3057\u3066\u307f\u305f","height":"190","published":"2015-07-31 08:30:29","description":"30\u5206\u304f\u3089\u3044\u3067\u3067\u304d\u308b\u7c21\u5358\u306a\u554f\u984c\u63a2\u3057\u3066\u3066mzp\u3055\u3093\u306e\u3084\u3064\u3092\u898b\u3064\u3051\u3066\u305d\u308c\u3092\u89e3\u3044\u3066\u307f\u3066\u308b\uff0e \u3053\u308c\u304c\u52d5\u3051\u3070\u3044\u3044 Dog = MyStruct.new(:name, :age) fred = Dog.new('fred', 5) fred.age = 6 printf \"name:%s age:%d\\n\", fred.name, fred.age \u56de\u7b54 class MyStruct def self.new(*names) Class.new do |_obj| def initialize(*values) @__values = values end names.each_with_index do\u2026","provider_url":"https://hatena.blog","blog_url":"https://ganmacs.hatenablog.com/","url":"https://ganmacs.hatenablog.com/entry/2015/07/31/083029","author_name":"ganmacs"}