title: Is it possible to extend a class by using a string as a module ? - Ruby 2.7.1
body: <p>I am doing some tests with Ruby 2.7.1 on FreeBSD 12.1. I know how to extend a class with module with for instance this :</p>
  <pre><code>class Myclass
    def mymethod
      extend Mymodule
    end
  end
  </code></pre>
  <p>But is it possible to obtain the same result with something that looks like this :</p>
  <pre><code>class Myclass
    def mymethod
      var = &quot;Mymodule&quot;
      extend var
    end
  end
  </code></pre>
  <p>If I do this like that, I off-course obtain an error, since extend is pointing to a string and not a module.</p>
  <p>Here are some explanations - it would be useful in the following application for instance :</p>
  <p>Imagine you have a folder with a lots of ruby scripts, all of them are module with obvious name. For instance abcd.rb will contain the module Abcd. So I create a file list and save it in an array. Then I can load or require all these file listed in this array. Since the name of modules are predictable, I just have to do some .sub, .chop and .capitalize method to the indices of my array in order to obtain a viable result that looks just like the name of a module.</p>
  <p>The idea would be to create a mean of extending my main class with all these modules automatically. In this idea, any modules added to the folder will be automatically loaded and ready for use.</p>
  <p>But since the result of my array operations are not &quot;pure&quot; modules names but String I got stuck right here.</p>
  <p>So, is there any way to achieve this (maybe I use a wrong path to do so) or is not possible ?</p>
  <p>Thanks in advance !</p>