【发布时间】:2009-07-27 08:38:32
【问题描述】:
如何检查一个类是否已经存在于 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. ....."
【问题讨论】: