{"type":"rich","description":"Ruby\u306b\u306fStruct\u3068\u3044\u3046\u30af\u30e9\u30b9\u304c\u3042\u308b\u3002 \u30c7\u30fc\u30bf\u3092\u51fa\u3057\u5165\u308c\u3059\u308b\u5c02\u7528\u306e\u30af\u30e9\u30b9\u3092\u7c21\u5358\u306b\u5b9a\u7fa9\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3060\u3002 Hoge = Struct.new(:x, :y) foo = Hoge.new(5, 10) p foo.x # => 5 p foo.y # => 10 foo.x = 20 p foo.x # => 20 Struct.new\u3059\u308b\u3053\u3068\u3067\u3001\u305d\u306e\u5f15\u6570\u306eattr_accessor\u6307\u5b9a\u30b7\u30f3\u30dc\u30eb\u3092\u5b9a\u7fa9\u3057\u305f\u3088\u3046\u306a\u30b5\u30d6\u30af\u30e9\u30b9\u3092\u751f\u6210\u3059\u308b\u3002 \u751f\u6210\u3055\u308c\u305f\u30b5\u30d6\u30af\u30e9\u30b9\u306e\u5b9f\u4f53\u306f\u30af\u30e9\u30b9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3042\u308a\u3001\u3088\u3046\u3059\u308b\u306b\u30af\u30e9\u30b9\u3092\u751f\u6210\u3059\u308b\u30af\u30e9\u30b9\u3067\u3001\u30e1\u30bf\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u6d3b\u7528\u3057\u305f\u6a5f\u80fd\u3060\u3002 Hoge = Struct.n\u2026","height":"190","blog_url":"https://mirichi.hatenadiary.org/","version":"1.0","url":"https://mirichi.hatenadiary.org/entry/20100712/p1","categories":["Ruby"],"provider_name":"Hatena Blog","author_name":"mirichi","width":"100%","provider_url":"https://hatena.blog","title":"class\u3068Struct","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmirichi.hatenadiary.org%2Fentry%2F20100712%2Fp1\" title=\"class\u3068Struct - mirichi\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>","image_url":null,"blog_title":"mirichi\u306e\u65e5\u8a18","published":"2010-07-12 00:00:00","author_url":"https://blog.hatena.ne.jp/mirichi/"}