I
Im still
[Note: parts of this message were removed to make it a legal post.]
Hi all
I'm thinking about a question, that is : Several classes will have a method
in a same name (probably do same thing too).
then in a program I want the method calling class name coming from a
variable( or maybe a result of a expr).
for example:
class A
def abc end
end
class B
def abc end
end
#what i want to do is something like
a = a_variable.abc # a_variable = A | B
Now I'm doing this by
a = eval(" #{a_variable}.abc ")
My question is, is there any better (or nicer) way to doing this?
Thanks
Hi all
I'm thinking about a question, that is : Several classes will have a method
in a same name (probably do same thing too).
then in a program I want the method calling class name coming from a
variable( or maybe a result of a expr).
for example:
class A
def abc end
end
class B
def abc end
end
#what i want to do is something like
a = a_variable.abc # a_variable = A | B
Now I'm doing this by
a = eval(" #{a_variable}.abc ")
My question is, is there any better (or nicer) way to doing this?
Thanks