<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>kamatama_41</author_name>
  <author_url>https://blog.hatena.ne.jp/kamatama_41/</author_url>
  <blog_title>かまたま日記3</blog_title>
  <blog_url>https://kamatama41.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>RubyのクラスはClassクラスのオブジェクトなので、インスタンス変数を持てます。クラスレベルとかクラスメソッドの中で定義された@付きの変数はクラスインスタンス変数(Class Instance Variable)と呼ばれ、そのクラスからしか参照できません、継承されてる場合、継承先でも参照できません。仕事中に継承しているクラスでBaseの値を参照しようとしてちょっとハマった次第であります。 バージョンは2.5.0です。 class Base def self.get @keys end def self.add(key) @keys ||= [] @keys &lt;&lt; key end add(&quot;…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkamatama41.hatenablog.com%2Fentry%2F2018%2F03%2F31%2F073305&quot; title=&quot;クラスインスタンス変数はそのクラスからしか参照できない - かまたま日記3&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2018-03-31 07:33:05</published>
  <title>クラスインスタンス変数はそのクラスからしか参照できない</title>
  <type>rich</type>
  <url>https://kamatama41.hatenablog.com/entry/2018/03/31/073305</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
