Hi,
I've got a hypothetical question, and im hoping someone can answer it.
Let's say ive got a MySql server and I store some Ruby code inside a
column/table/database. Is there anyway I can load this data from a Ruby
program and execute the code as if it was a part of the program?
On Jan 6, 2008 6:31 PM, Petr Janda <petr@punchyouremployer.com> wrote:
Hi,
I've got a hypothetical question, and im hoping someone can answer it.
Let's say ive got a MySql server and I store some Ruby code inside a
column/table/database. Is there anyway I can load this data from a Ruby
program and execute the code as if it was a part of the program?
--
Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.
There could be a few ways to do this.
One method would be actually loading that text to a string, and the string having a file name like name. Then use try to "load that_string.rb"
No idea if that would work.
The method that would work for sure, get data from DB, save it as a .rb text file, "load" the file. Of course, that's pointless if you have to do all of that.
If you just want snippets of code, use eval on the snippets loaded from DB.
Generally speaking, the file system of the OS is going to be faster than any DB.
···
On Jan 6, 2008, at 7:01 AM, Petr Janda wrote:
Hi,
I've got a hypothetical question, and im hoping someone can answer it.
Let's say ive got a MySql server and I store some Ruby code inside a
column/table/database. Is there anyway I can load this data from a Ruby
program and execute the code as if it was a part of the program?