Ruby学习五 知识点总结
+++++++++++++++++++++++++++++++++++++++++++
?
这句话是什么意思 render:text=> "hello world"
?
?
写全了就是
render({:text => "hello world"})
把这个hash作为参数传进去。
?
++++++++++++++++++++++++++++++++++++++++++++
?
Array(nil)??? # => []
Array([])???? # => []
Array(1)???? # => [1]
Array([2])?? # => [2]
?
++++++++++++++++++++++++++++++++++++++++++++
?
各种排序的Ruby实现
http://www.iteye.com/topic/280891
?
+++++++++++++++++++++++++++++++++++++++++++++++++++++++?#find 找出符合条件的第一个元素,返回该元素?
"q"或者"Q"后面跟着的是分隔符,如果它是开大括号、方括号、圆括号或者是小于号,那么字符串结束于和它匹配的符号处,否则,结束于和它相同的字符处
?
http://www.zzbaike.com/wiki/Ruby-%E6%A0%87%E5%87%86%E7%B1%BB%E5%9E%8B
?
++++++++++++++++++++++++++++++++++++++++++++
?
方法可以通过 if 语句加上 block_given? 条件,来判断方法在执行的时候,是否有块在后面,如果有,就执行if语句,再根据yield调用块,如果后面没有块,就继续执行if后面的代码?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?? str.upcase 等同 str.send("upcase")
???send 发送的消息,在程序运行时是可变的,可以根据不同的输入,动态的向对象发送不同的消息
?
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
Gemfile.lock 则用来记录本机目前所有依赖的 RubyGems 和其版本。?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
a?=?[?1,?3,?5,?7,?9?]??
(译者注:注意负整数索引的方向依然是从前向后)
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
?
++++++++++++++++++++++++++++++++++++++++++++
?
?
++++++++++++++++++++++++++++++++++++++++++++