嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 1 元微信扫码支付:1 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
ruby an introduction(ruby简介)
Ruby, an Introduction
Jim Menard, jimm@io.com
July 10, 2001
Contents
1 Introductions 2
1.1 Me . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Ruby . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2.1 History and Pedigree . . . . . . . . . . . . . . . . . . . 2
2 Why Ruby? 2
2.1 Why Not? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Language Features 3
4 Comparison With Other Languages 5
4.1 Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.2 Perl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.3 Smalltalk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.4 Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
5 Code Examples 8
5.1 A class with a few simple methods . . . . . . . . . . . . . . . 8
5.2 Iterating over a collection . . . . . . . . . . . . . . . . . . . . 13
5.3 Reading a file . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5.4 Parsing XML . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6 Practical Ruby Experience 22
7 Tools 22
8 Advantages and Disadvantages 23
8.1 Advantages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.2 Disadvantages . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
9 Resources 24