ruby:如何获取当前类而不是基类中定义或覆盖的所有方法?
有谁如何获取当前类而不是基类中定义或覆盖的所有方法? 例如,
class MyBase
def Test
end
end
class MyDerived
def Test1
end
end
当我调用 MyDerived.methods 时,我得到了很多方法,但我只想得到“Test1”,因为它是它自己的方法,这可能吗? 谢谢。
Does anyone how to get all the methods that are defined or overwrited in current class rather than base class?
e.g.
class MyBase
def Test
end
end
class MyDerived
def Test1
end
end
When I call MyDerived.methods, i got a lot of methods, but I only want to get 'Test1' because it is its own method, is it possible?
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)