-
Windows平台上的Ruby编译器首推RubyInstaller的7z绿色版,其次是exe安装包,最后还可以选择JRuby,需要jre才能运行,Windows上有zip和exe安装包两种方式供选择,Linux上有gz包。RubyInstaller的运行速度远高于JRuby。
-
跳出嵌套层次
030后面的数字是嵌套层次,用end可以跳到上一级。 irb(main):030:2> end
irb(main):030:1>
- Ruby语言模型(引自"3.2 The Ruby Universe" of Brian Marick: "Everyday Scripting with Ruby"):
When you run the inventory.rb script, you create a little Ruby universe. That universe, in essence, contains only three kinds of things: nouns, verbs, and names. The nouns are usually called objects. They are the “things” in the Ruby universe. Objects just sit there until they’re told to do something. That’s where the verbs come in. All the verbs in the Ruby universe are imperative: verbs like “sit!” and “stay!” and “roll over!” In Ruby, these verbs are called messages, and telling an object to do some-thing is called sending a message.