<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>hatappo</author_name>
  <author_url>https://blog.hatena.ne.jp/hatappo/</author_url>
  <blog_title>(-&gt;&gt; read write unlearn)</blog_title>
  <blog_url>https://hatappo.hatenadiary.jp/</blog_url>
  <categories>
    <anon>ruby</anon>
  </categories>
  <description>クラス（やモジュール）定義のイベントの発生時に自動で呼ばれるメソッドが、Rubyには組み込みで用意されています。例えば、「継承」というイベントをhookするメソッドはBasicObject#inherited(klass)です。 inheritedを使って、「このクラスは継承して欲しくないので、継承したら例外を投げる」という実装をしてみます。 class NonInheritable def self.inherited(klass) super raise StandardError, &quot;#{self} is not allowed to be inherited.&quot; end def met…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhatappo.hatenadiary.jp%2Fentry%2F2015%2F09%2F20%2F051345&quot; title=&quot;Ruby クラスフック：クラス（モジュール）定義で起きるイベントを掴んで何かする - (-&amp;gt;&amp;gt; read write unlearn)&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>2015-09-20 05:13:45</published>
  <title>Ruby クラスフック：クラス（モジュール）定義で起きるイベントを掴んで何かする</title>
  <type>rich</type>
  <url>https://hatappo.hatenadiary.jp/entry/2015/09/20/051345</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
