首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何检查Ruby中是否已存在类

如何检查Ruby中是否已存在类
EN

Stack Overflow用户
提问于 2009-07-27 08:38:32
回答 14查看 46.3K关注 0票数 70

如何检查类在Ruby中是否已经存在?

我的代码是:

代码语言:javascript
复制
puts "enter the name of the Class to see if it exists"   
nameofclass=gets.chomp  
eval (" #{nameofclass}......  Not sure what to write here")

我在考虑使用:

代码语言:javascript
复制
eval "#{nameofclass}ancestors.     ....."
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1187089

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档