title: Instantiate class and push to array Ruby
body: <p>I'm trying to instantiate all the classes in the scenes directory and add them to my scenes array. So far the code looks like it should work but I get a strange rgexp -ct error that I can't find any answers for online. Here's my code</p>
  
  <pre><code>class Game
      @scenes = []
  
      def initialize
          Dir[File.dirname(__FILE__)+"/scenes/*.rb"].each do |file|
              require_relative file
              @scenes &lt;&lt; eval("#{file.gsub(".rb", "")}.new()")
          end
      end
  end
  </code></pre>
  
  <p>And here's what a scene in the directory looks like. I can require them and see the filenames just fine.</p>
  
  <pre><code>class Scene99
      @number = 99
      @text = "This is the first scene."
      @next_scene = 0
  
      def initialize
          puts "WORKS"
      end
  end
  </code></pre>
  
  <p>Here's the Syntax Error about regexp that I get, This only appears when I try to run the eval(...</p>
  
  <pre><code>/Users/icetimux/projects/death-at-appledore-towers/lib/death-at-appledore-towers/game.rb:8:in `eval': (eval):1: unknown regexp options - ct (SyntaxError)
          from /Users/icetimux/projects/death-at-appledore-towers/lib/death-at-appledore-towers/game.rb:8:in `block in initialize'
          from /Users/icetimux/projects/death-at-appledore-towers/lib/death-at-appledore-towers/game.rb:6:in `each'
          from /Users/icetimux/projects/death-at-appledore-towers/lib/death-at-appledore-towers/game.rb:6:in `initialize'
          from death-at-appledore-towers.rb:3:in `new'
          from death-at-appledore-towers.rb:3:in `&lt;main&gt;'
  </code></pre>