红宝石中%i或%I的含义是什么?
我在Google搜索了
"%i or %I" ruby
但没有发现与红宝石有关的任何东西。
%i[ ] # Non-interpolated Array of symbols, separated by whitespace
%I[ ] # Interpolated Array of symbols, separated by whitespace
我的搜索结果中的第二个链接http://ruby.zigzo.com/2014/08/21/rubys-notation/
IRB中的示例:
%i[ test ]
# => [:test]
str = "other"
%I[ test_#{str} ]
# => [:test_other]
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句