作者:empty 页数:178 出版社:empty |
Ruby Pocket ReferenceRuby is an opensource, object-oriented programming lan-guage created by Yukihiro“Matz*Mat sur no to.First releasedi Japan in 1995Rubyhasganedwrldwdea ceep tance asan easy-to-learn, power tul, and expressive language, espec tally since the advent of RubyonRails.a web applicationframework wnt ten in Ruby(hut po/www.ubyonrailsorg) .Ruby'score is written in the C programming language andruns on all major platforms.It is an interpreted rather thancompiled language.For more an formation on Ruby, see http://www.ruby-iangorg-Conventions Used in This BookThe following font conventions are used in this bookItalicIndicare s pathnames and fle names(such as programnames) ; Inte met addresses, such as domainnames andURLs; and emphasized or newly defined terms.Constant mid thIndie ates commands and options that should be typed ver-ba tim in a file or in irb.or names and key wards in Rubyprograms, in eluding method, variable, and class nam nes.Constant width italicIndicates user-supplied values.Constant Mid th boldUsed to draw attention to parts of programs.
Running Ruby
Running the Ruby Interpreter23
Reserved Wrds
peratrs
Cmments
Numbers
Variables
Caver Designer.Karen Mnt game ty
Interir Designer:David Fu tate
Ilh us tratrs:Rbert Rman and
Jess am Read
July 2007
Lcal Variables
Instance Variables
Class Variables
Glbal Variables
Cnstants
Symb s
Predefined Variables
Pseud variables
Glbal Cnstants
First Edu in.
MethdName Cnventins
Default Arguments
Var lable Arguments
Aliasing Methds
Cnditinal Statements
The if Statement
The unless Statement
The while Statement
The until Statement
The case Statement
The fr Lp
The Ternary peratr
Class Variables
pening an Existing File
The rescue and ensure Clauses
Executing Cde Befre r After a Prgram
Classes
Instance Variables
Accessrs
Class Methds
Singletns
Inheritance
Pubic, Private, r Prtected
Mdules and Mixins
iv|Can tents
Files
Creating a New File
ARGV and ARG F
Renaming and Deleting Fles
ile Mdes and wnership
The catch and thrw Methds
File Inquiries
The l Class
Exceptin Hand