Questions tagged «content-length»

6
数量,大小,长度……在Ruby中有太多选择?
我似乎找不到确切的答案,我想确保自己了解“ n级” :-) a = {“ a” =>“ Hello”,“ b” =>“世界”} a.count#2 a。大小#2 长度#2 a = [10,20] a.count#2 a。大小#2 长度#2 那么该使用哪个呢?如果我想知道a是否具有多个元素,那么这似乎无关紧要,但是我想确保自己了解真正的区别。这也适用于数组。我得到相同的结果。 另外,我认识到ActiveRecord的count / size / length具有不同的含义。我现在对纯Ruby(1.92)最为感兴趣,但是如果有人想了解一下AR的不同之处,那也将不胜感激。 谢谢!
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.