J
James Somers
Hi there,
I know this might sound unorthodox but I am storing a function and
parameters in a database for a particular set of class methods. Most of
the functions have the same arguments but a few others have extra
parameters after.
So instead of having a separate column for each parameter I am instead
putting all the parameters in a single database column which I want to
pass so I would like to do something like this:
class Klass
def self.some_function(age, weight, name); end
end
function_name = "some_function"
function_args = "12, 14, 'james'"
Klass.send function_name, function_args
Is there any way to do this? I have looked at things like *args but I
would really like to keep the signature of the function the same because
it'd require a lot of refactoring otherwise.
Cheers,
James
I know this might sound unorthodox but I am storing a function and
parameters in a database for a particular set of class methods. Most of
the functions have the same arguments but a few others have extra
parameters after.
So instead of having a separate column for each parameter I am instead
putting all the parameters in a single database column which I want to
pass so I would like to do something like this:
class Klass
def self.some_function(age, weight, name); end
end
function_name = "some_function"
function_args = "12, 14, 'james'"
Klass.send function_name, function_args
Is there any way to do this? I have looked at things like *args but I
would really like to keep the signature of the function the same because
it'd require a lot of refactoring otherwise.
Cheers,
James