mystruct = Struct.new(:one,:two, :three,:four)
如何调用 mystruct
并获取所有访问器的列表?
结果:[:one,:two,:three, :four]
。
最佳答案
这更广为人知的是 members
:
Struct.new(:one,:two, :three,:four).members
# [:one, :two, :three, :four]
关于ruby-on-rails - 调用一个新结构并获取列出的所有访问器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58027632/