如何检查类在Ruby中是否已经存在?
我的代码是:
puts "enter the name of the Class to see if it exists"
nameofclass=gets.chomp
eval (" #{nameofclass}...... Not sure what to write here")
我在考虑使用:
eval "#{nameofclass}ancestors. ....."
https://stackoverflow.com/questions/1187089
复制相似问题