<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>griefworker</author_name>
  <author_url>https://blog.hatena.ne.jp/griefworker/</author_url>
  <blog_title>present</blog_title>
  <blog_url>https://tnakamura.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>Ruby では、Module.const_get メソッドで、文字列からモジュールやクラスを取得できる。プラグイン機構をもつアプリを作るときに使えそうなので、メモしておく。 # coding: utf-8 class Hello def greet(name) puts &quot;Hello, #{name}.&quot; end end # トップレベルに定義しているクラスなら、 # const_get でクラスを取得できる hello = Module.const_get(&quot;Hello&quot;) h = hello.new h.greet &quot;Kagawa&quot; module Greeting class Mornin…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftnakamura.hatenablog.com%2Fentry%2F20120607%2Fconst_get&quot; title=&quot;クラス名の文字列からクラスを取得する方法 - present&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>2012-06-07 00:00:00</published>
  <title>クラス名の文字列からクラスを取得する方法</title>
  <type>rich</type>
  <url>https://tnakamura.hatenablog.com/entry/20120607/const_get</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
