<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>yuheiomori0718</author_name>
  <author_url>https://blog.hatena.ne.jp/yuheiomori0718/</author_url>
  <blog_title>メモ置き場</blog_title>
  <blog_url>https://y0m0r.hateblo.jp/</blog_url>
  <categories>
    <anon>ruby</anon>
    <anon>python</anon>
    <anon>metaprogramming</anon>
  </categories>
  <description>ちょっと前まではrubyで、最近はpythonで仕事をしているので、rubyでやっていたアレ、pythonだとどうやるんだろ？と思うことがたまにあります。 で、クラスへのインスタンスメソッド追加ですが、 rubyではオープンクラスによって、インスタンスメソッドが追加できます以下はメタプログラミングRubyで紹介されている例で、Stringクラスにメソッドを追加してます class String def to_alphanumeric gsub /[^\w\s]/, '' end end &quot;#3, the *Magic Number?*&quot;.to_alphanumeric # =&gt; =&gt; &quot;3 t…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fy0m0r.hateblo.jp%2Fentry%2F20120114%2F1326545228&quot; title=&quot;Ruby、Pythonでクラスのインスタンスメソッドを追加する - メモ置き場&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>http://ecx.images-amazon.com/images/I/51TODrMIEnL.jpg</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2012-01-14 21:47:08</published>
  <title>Ruby、Pythonでクラスのインスタンスメソッドを追加する</title>
  <type>rich</type>
  <url>https://y0m0r.hateblo.jp/entry/20120114/1326545228</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
