首先,在ruby1.8中類變數是所有子類和父類共用的,可以看下面的代碼: class IntelligentLife @@home_planet = nil def self.home_planet @@home_planet end def self.home_planet=(x) @@home_planet = x end #... end class Terran
Disclaimer: Every time we've run a piece about benchmarking or performance numbers on Ruby Inside, a retraction or significant correction has come out shortly thereafter. Benchmarking is hard, ugly, and quite often wrong or biased. It is not useless,
Ruby Plus is a site offering free Ruby and Rails related screencasts recorded by Bala Paranj, much in the same vein as Ryan Bates' Railscasts. The screencasts are generally similar in length and overall format to those from Railscasts. So far there
It's pretty rare I recommend new blogs to follow on Ruby Inside. Not because I don't like them - I link to their posts all the time! - but because it's hard to tell if a new blog is going to keep going and be worth your while.Well, the Ruby
關於Ruby的介紹請參照:http://www.ruby-lang.org/zh_CN/about/一、IRB 互動式Ruby協助和控制台程式,Windows下成為fxri。 在IRB中可以直接執行Ruby代碼。如:Code highlighting produced by Actipro CodeHighlighter
Ruby的資料類型主要有兩類:整數(Integer)和字串(String)Ruby是全OO的程式設計語言,和C++等不同,其整數和字串也是類類型。 Integer類型有兩類,當Integer值在-2^30 to 2^30-1(or -2^62 to 2^62-1,跟機器碼長有關)之間時,用的Fixnum類類型,當不在上述範圍時,用的是Bignum類類型,Bignum類類型可以表示記憶體剩餘空間中可表示的最大數值,它是由一系列的short integer組成的。 常用的成員有:
從前面我們示範的例子,你可能會對我們早先所宣稱的Ruby是一種物件導向的語言而感到奇怪。那麼,我們通過這章內容來證明它。我們將要介紹怎樣使用Ruby建立類和對象,並介紹Ruby在哪些方面比大部分的物件導向語言要更強大。讓我們一步步地實現一個百萬美元的產品,Internet Enabled Jazz and
Learning more than one programming languages,perferable many different style ones, like scripting, object-oriented,functional, logic,etc. Learning languages teaches you many about programming . Read good bools, for example, "Pragmatic Programmers"