<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>kamatimaru</author_name>
  <author_url>https://blog.hatena.ne.jp/kamatimaru/</author_url>
  <blog_title>delhi09の勉強日記</blog_title>
  <blog_url>https://kamatimaru.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>Rubyの特徴であるオープンクラスの勉強のため、Stringクラスに絵文字変換メソッドを追加してみます。 例えば、&quot;カレー&quot;.to_emojiを実行すると🍛がreturnされるイメージです。 実装 以下のように簡単に実装できました。 class String def to_emoji case self when &quot;カレー&quot; &quot;🍛&quot; when &quot;ラーメン&quot; &quot;🍜&quot; when &quot;寿司&quot; &quot;🍣&quot; else self end end end Stringインスタンス自身を参照するためにはselfが使えます。 docs.ruby-lang.org 実行結果 # ※ class定義に続けて実行 puts…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkamatimaru.hatenablog.com%2Fentry%2F2025%2F10%2F26%2F224357&quot; title=&quot;RubyのStringクラスに絵文字変換メソッドを追加してみる(オープンクラスの勉強) - delhi09の勉強日記&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>2025-10-26 22:43:57</published>
  <title>RubyのStringクラスに絵文字変換メソッドを追加してみる(オープンクラスの勉強)</title>
  <type>rich</type>
  <url>https://kamatimaru.hatenablog.com/entry/2025/10/26/224357</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
