From: Marc Heiler Date: 2011-10-11T23:03:48+09:00 Subject: A .rb file without module, loading it inside a new module at runtime. Hi. First my problem in general. I have a ruby-gtk app. On startup, I load one .rb file. Every method found in that file, will become a button. When you click that button, that method is executed. Right now, it does not work because I am not sure how to call a method from one specific file ... when I only have the method name as a string. (I am still stuck at this problem.) I then wondered about something else though ... Let's say I have a file with ruby code, without any modules inside. Can I load the whole thing into a module at runtime? Example in pseudocode: file = File.open('foobar.rb') Module.create(file) The above would create a new module for the file 'foobar.rb' and the name would be the filename without trailing .rb, the same as one would do: module Foobar At the beginning of that file. Is that possible with ruby code at runtime? -- Posted via http://www.ruby-forum.com/.