Ruby ruby string to class

liwen_zhang · May 02, 2012 · Last by fsword replied at May 06, 2012 · 3389 hits

Kernel.const_get(:User) # Object.const_get(:User) eval(’User’) ‘User’.constantize User.send("first")

const_get/eval/constantize/send

哥们,谁能帮小弟解释一下: 他们有什么区别?通常适用于什么地方?有什么注意事项?

还是系统的看看书和 rubydoc 再问吧,说起来挺罗嗦的

You need to Sign in before reply, if you don't have an account, please Sign up first.