T
Tristan Shelton
Hello all, I'm working on a small program -- and learning to love Ruby
all over again -- but I've come across a small dilemma: What if you want
to make a Ruby program that can be extended without modifying the
original code? That is, a Ruby script that can itself be scripted.
What I'm thinking of is something that gives users the ability to do
basic math, access explicitly allowed methods and properties and maybe
even allow user defined variables available only to that script, while
disallowing any other use of the parent Ruby script. Something that is
to Ruby what Ruby, Perl and Python are to C/C++.
I considered loading chunks of Ruby script and using eval() in a safe
context, and also considered creating a very simple interpreted
scripting language in Ruby, but before I proceed with either option I
would like to pose this question to fellow Ruby enthusiasts: How would
you handle making a scriptable/extensible Ruby program like this?
all over again -- but I've come across a small dilemma: What if you want
to make a Ruby program that can be extended without modifying the
original code? That is, a Ruby script that can itself be scripted.
What I'm thinking of is something that gives users the ability to do
basic math, access explicitly allowed methods and properties and maybe
even allow user defined variables available only to that script, while
disallowing any other use of the parent Ruby script. Something that is
to Ruby what Ruby, Perl and Python are to C/C++.
I considered loading chunks of Ruby script and using eval() in a safe
context, and also considered creating a very simple interpreted
scripting language in Ruby, but before I proceed with either option I
would like to pose this question to fellow Ruby enthusiasts: How would
you handle making a scriptable/extensible Ruby program like this?