Skip to content

Commit 4cda973

Browse files
committed
Imported the "zh_cn" content.
1 parent 87939dc commit 4cda973

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3378
-1
lines changed

index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
'ko-kr': 'ko',
2222
'ko': 'ko',
2323
'pl': 'pl',
24-
'tr': 'tr'
24+
'tr': 'tr',
25+
'zh_cn': 'zh_cn'
2526
};
2627

2728
var language = languages[window.navigator.language];

zh_cn/about/index.md

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
---
2+
layout: page
3+
title: "关于 Ruby - Ruby 官方网站"
4+
lang: zh_cn
5+
---
6+
7+
想知道 Ruby 为什么会如此受欢迎吗?为什么使用过它的支持者都称赞它为巧妙、优雅且易用更实用有趣的语言?
8+
9+
### Ruby 发明者的理想
10+
11+
![](http://redhanded.hobix.com/images/ruby-lang-matz.png){:
12+
style="padding-left:8px;"}
13+
{: style="float:right"}
14+
15+
Ruby 是一个注重均衡的语言,它的发明者[松本行弘 Yukihiro “matz” Matsumoto][1],混合了他喜欢的语言(Perl、
16+
Smalltalk、 Eiffel、 Ada 和 Lisp ) 产生了一种具有函数式及指令程序设计特性的新语言。
17+
18+
他常说,他是“试着让 Ruby 更自然,而不是简单,就像生活一样”。
19+
20+
除此之外,他还提到:
21+
22+
Ruby 就像人的身体一样,表面上看来简单,但是内部却相当的复杂\[1\]
23+
24+
### Ruby 的成长
25+
26+
在 1993 年,没有人会相信一个由日本业余语言设计者创建的面向对象的语言,能最终在世界范围内被广泛使用并且变得几乎像 Perl 那样流行。自从
27+
1995 年 Ruby 公开发表以来,Ruby 在全球吸引了许多忠实的程序设计员。在 2006 年,Ruby
28+
被广泛接受。在各大城市都有活跃的使用者并通过社区举办许许多多场场爆满的研讨会。
29+
30+
![Graph courtesy of
31+
Gmane.](http://gmane.org/plot-rate.php?group=gmane.comp.lang.ruby.general&width=280&height=140&title=Ruby-Talk+Activity+over+4+Years
32+
"Graph courtesy of Gmane."){: style="padding-left:8px;"}
33+
{: style="float:right"}
34+
35+
在 Ruby-Talk,主要的[ 邮件列表](/zh_CN/community/mailing-lists/) 上,讨论 Ruby
36+
语言的文章爬升到每日 200 封。
37+
38+
在 TIOBE, 最流行的开发语言排名调查中, Ruby 排名为全球第 11 位。 根据这样的成长情况,他们预测“在半年之中 Ruby
39+
将会进入最受欢迎开发语言的前 10 名。”有越来越多受欢迎的软件如 Ruby on Rails web
40+
framework<sup>[2](#fn2)</sup> 是使用 Ruby 撰写而成,也是造成 Ruby 如此快速成长的原因。
41+
42+
Ruby 是[开源软件](./license.txt)。 不只是免费,而且可以自由的使用、复制、修改与发布。
43+
44+
### 所见到的都是对象
45+
46+
最初,Matz
47+
从其它语言中找寻理想的语法,在网络上他做了一段时间的调查,找到候选如“Perl“和“Python“。但都不是他想要的,他需要一个比 Perl
48+
更强大、比 Python 更面向对象的语言\[3\]
49+
50+
在 Ruby 中,所有的东西都是对象,所有的信息和代码都可以给它们所拥有的属性和行为。面向对象程序设计中称属性为实例变量(*instance
51+
variables*),称命令为方法 (*methods*)。 从下列程序代码中看到 Ruby 能够给数字赋于行为,从这点可以证明 Ruby
52+
是纯面向对象的语言。
53+
54+
5.times { print "We *love* Ruby -- it's outrageous!" }
55+
{: .code .ruby-code}
56+
57+
在许多语言中,数字和其它原生的类型都不是对象。而 Ruby 受 Smalltalk
58+
语言影响,让所有的类型都可以赋予方法及产生实例变量,并让这些规则适用于 Ruby 所有对象。
59+
60+
### Ruby 的灵活性
61+
62+
Ruby 是一个相当灵活的语言,她允许用户去改变她本身。 Ruby 的核心部分可以被更改或重新定义,模块可以被添加。Ruby
63+
试着不去妨碍程序员。
64+
65+
比如(`+`) 是用做加法的运算符。如果你更喜欢使用易读的 `plus` 的话,你可以给 Ruby 的内建 `Numeric` 类添加一个函数。
66+
67+
class Numeric
68+
  def plus(x)
69+
    self.+(x)
70+
  end
71+
end
72+
73+
y = 5.plus 6
74+
# y is now equal to 11
75+
{: .code .ruby-code}
76+
77+
Ruby 的符号只是语法的甜头 (syntactic sugar)。你可以随时重定义他们。
78+
79+
### Blocks,一个独特且强大的特性
80+
81+
Ruby 的代码块是非常强大的。程序员可以给任何函数添加一个密封 (closure)
82+
来表述这个函数该如何工作。密封也被叫做代码块,是用过其他比如 PHP, Visual Basic 等规则语言的 Ruby
83+
的初学者最喜欢使用的一个功能。
84+
85+
代码块取自函数语言。Matz 说:“我希望在 Ruby 的密封中融入 Lisp 的文化 \[4\]。”
86+
87+
search_engines =
88+
  %w[Google Yahoo MSN].map do |engine|
89+
    "http://www." + engine.downcase + ".com"
90+
  end
91+
{: .code .ruby-code}
92+
93+
在上面的代码中,代码块是在 `do ... end` 中的结构。 `map` 函数将代码块应用到一个词的列表中。Ruby
94+
的其他函数经常会为程序员留出一个空当给代码块来控制函数的功能。
95+
96+
### Ruby 与 Mixin
97+
98+
于其他面向对象语言不同,Ruby “有意”只提供单继承。不过 Ruby 拥有模块(在 Objective-C
99+
里面叫做类别)。模块是把许多方法放在了一个类别里。
100+
101+
类可以混合一个模块,得到这个模块提供的所有方法。比如所有提供 `each` 方法的类可以混合 `Enumerable`
102+
模块,来得到这个模块提供的所有方法,当然这些方法都会调用 `each` 做循环。
103+
104+
class MyArray
105+
  include Enumerable
106+
end
107+
{: .code .ruby-code}
108+
109+
一般来说,Ruby 爱好者相对于复杂和限制颇多的多态继承方法来讲更偏向于这种混合方法。
110+
111+
### Ruby 的面貌
112+
113+
尽管 Ruby 只用很少的符号并且偏向与英文单词做关键字,但是少量的符号也被用来装饰 Ruby。Ruby
114+
不需要提前定义变量。它用简单的命名法来提示变量存在的范围。
115+
116+
* `var` 可以是局部变量。
117+
* `@var` 是一个实例变量。
118+
* `$var` 是一个全局变量。
119+
120+
这些信号让程序员更清楚的看到每一个变量的角色,增强了程序的可读性,也不需要在实例变量前面加上 `self.` 了。
121+
122+
### 更上一层楼
123+
124+
Ruby 还有其他丰富的特性:
125+
126+
* Ruby 有类似于 Java 和 Python 的异常处理,使处理错误更方便。
127+
^
128+
129+
* Ruby 有一个真正的表示-清扫(mark-and-sweep)垃圾手机器来出来所有的 Ruby 对象。不需要在库里维护引用数了。就像
130+
Matz 说的:“这对您健康有意。”
131+
^
132+
133+
* 为 Ruby 写 C 的扩展比 Perl 和 Python 更容易。Ruby 有一个非常雅致的 API 从 C 语言调用 Ruby。这包括把
134+
Ruby 作为嵌入式脚本语言时,从其他软件里调用 Ruby。SWIG 界面也是可选的。
135+
^
136+
137+
* Ruby 可以在操作系统允许的情况下动态调用库。
138+
^
139+
140+
* Ruby 提供不依赖操作系统的线程。所以在所有 Ruby 支持的操作系统里都可以使用多线程处理,不管操作系统支不支持,比如 MS-DOS!
141+
^
142+
143+
* Ruby 极为轻便:它只要是在 GNU/Linux 上开发的,但也在很多类型的 UNIX 上运行,也支持 Mac OS X, Windows
144+
95/98/Me/NT/2000/XP,DOS,BeOS,OS/2 等。
145+
146+
#### 参考资料
147+
148+
<sup>1</sup> Matz, 在 Ruby-Talk 邮件列表, [5月12日, 2000][2].
149+
{: #fn1}
150+
151+
<sup>2</sup> 查看更多信息在 [Ruby on Rails][3] 主页.
152+
{: #fn2}
153+
154+
<sup>3</sup> Matz, 在 [Ruby 创造者的采访][4], 11月29日, 2001.
155+
{: #fn3}
156+
157+
<sup>4</sup> Matz, 在 [Ruby 的代码块和闭合][5], 12月22日, 2003.
158+
{: #fn4}
159+
160+
161+
162+
[1]: http://www.rubyist.net/~matz/
163+
[2]: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/2773
164+
[3]: http://rubyonrails.org/
165+
[4]: http://www.linuxdevcenter.com/pub/a/linux/2001/11/29/ruby.html
166+
[5]: http://www.artima.com/intv/closures2.html

zh_cn/about/license.txt

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
RUBY LICENSE
2+
3+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.co.jp>.
4+
You can redistribute it and/or modify it under either the terms of the GPL
5+
(see COPYING.txt file), or the conditions below:
6+
7+
1. You may make and give away verbatim copies of the source form of the
8+
software without restriction, provided that you duplicate all of the
9+
original copyright notices and associated disclaimers.
10+
11+
2. You may modify your copy of the software in any way, provided that
12+
you do at least ONE of the following:
13+
14+
a) place your modifications in the Public Domain or otherwise
15+
make them Freely Available, such as by posting said
16+
modifications to Usenet or an equivalent medium, or by allowing
17+
the author to include your modifications in the software.
18+
19+
b) use the modified software only within your corporation or
20+
organization.
21+
22+
c) rename any non-standard executables so the names do not conflict
23+
with standard executables, which must also be provided.
24+
25+
d) make other distribution arrangements with the author.
26+
27+
3. You may distribute the software in object code or executable
28+
form, provided that you do at least ONE of the following:
29+
30+
a) distribute the executables and library files of the software,
31+
together with instructions (in the manual page or equivalent)
32+
on where to get the original distribution.
33+
34+
b) accompany the distribution with the machine-readable source of
35+
the software.
36+
37+
c) give non-standard executables non-standard names, with
38+
instructions on where to get the original software distribution.
39+
40+
d) make other distribution arrangements with the author.
41+
42+
4. You may modify and include the part of the software into any other
43+
software (possibly commercial). But some files in the distribution
44+
are not written by the author, so that they are not under this terms.
45+
46+
They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
47+
files under the ./missing directory. See each file for the copying
48+
condition.
49+
50+
5. The scripts and library files supplied as input to or produced as
51+
output from the software do not automatically fall under the
52+
copyright of the software, but belong to whomever generated them,
53+
and may be sold commercially, and may be aggregated with this
54+
software.
55+
56+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
57+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
58+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
59+
PURPOSE.

zh_cn/community/conferences/index.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
layout: page
3+
title: "Ruby 会议 - Ruby 官方网站"
4+
lang: zh_cn
5+
---
6+
7+
Ruby programmers around the world are getting involved in more and more
8+
conferences, where they get together to share reports on
9+
work-in-progress, discuss the future of Ruby, and welcome newcomers to
10+
the Ruby community.
11+
12+
### Major Ruby Conferences
13+
14+
[RubyConf][1]
15+
: Every year since 2001, [Ruby Central, Inc.][2] has produced RubyConf,
16+
the International Ruby conference. Attendance grew by a factor of ten
17+
between 2001 and 2006. RubyConf has provided a forum for presentations
18+
about Ruby technologies by their creators, including talks by
19+
Nathaniel Talbot on Test Unit, Jim Weirich on Rake, David Heinemeier
20+
Hansson on Ruby on Rails, Why the Lucky Stiff on the YAML library, and
21+
Sasada Koichi on YARV. Matz has attended, and spoken at, all the
22+
RubyConfs but one.
23+
24+
[RubyKaigi][3]
25+
: The first Japanese Ruby conference, RubyKaigi 2006, took place in
26+
Odaiba. Future plans have not been announced—but keep an eye out for
27+
more Japanese events.
28+
29+
[EuRuKo <small>(Europaeische Ruby Konferenz)</small>][4]
30+
: The first annual European Ruby Conference (EuRuKo) was held in
31+
Karlsruhe, Germany, in 2003. Organized by a team of German Rubyists
32+
including Armin Roehrl and Michael Neumann, EuRuKo emerged as the
33+
second annual Ruby event, starting two years after RubyConf.
34+
35+
### Regional Ruby Conferences
36+
37+
[Ruby Central][2] administers a [Regional Conference Grant Program][5],
38+
to offset expenses for local and regional groups wanting to organize
39+
events.
40+
41+
Ruby Central has also teamed up with [SDForum][6] to produce the Silicon
42+
Valley Ruby Conference, entering its second year in 2007.
43+
44+
### Ruby At Other Conferences
45+
46+
There has been a Ruby track at the [O’Reilly Open Source Conference][7]
47+
(OSCON) since 2004, and an increasing presence on the part of Ruby and
48+
Rubyists at other non-Ruby-specific gatherings. A number of conferences
49+
have also been devoted to [Ruby on Rails][8], including Ruby Central’s
50+
[RailsConf][9], [RailsConf Europe][10] (co-produced in 2006 by Ruby
51+
Central and [Skills Matter][11], and in 2007 by Ruby Central and
52+
O’Reilly), and Canada on Rails.
53+
54+
55+
56+
[1]: http://www.rubycentral.org/conference
57+
[2]: http://www.rubycentral.org
58+
[3]: http://jp.rubyist.net/RubyKaigi2006/
59+
[4]: http://www.approximity.com/cgi-bin/europeRuby/tiki.cgi?c=v&amp;p=Euruko06
60+
[5]: http://www.rubycentral.org/rcg2006.pdf
61+
[6]: http://www.sdforum.org
62+
[7]: http://conferences.oreillynet.com/os2006/
63+
[8]: http://www.rubyonrails.org
64+
[9]: http://www.railsconf.org
65+
[10]: http://europe.railsconf.org
66+
[11]: http://www.skillsmatter.com

zh_cn/community/index.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
layout: page
3+
title: "社区 - Ruby 官方网站"
4+
lang: zh_cn
5+
---
6+
7+
编程语言社区成长的好坏是衡量出这个编程语言发展的状况很重要的一个方面。Ruby
8+
就拥有一个充满活力、不断壮大的社区,并且这个社区友好的对待每前来访问的个人,不管是初学者还是专家。
9+
10+
如果你想对参与其中很感兴趣,你可以先从这几个地方入手:
11+
12+
[Ruby 中文社区论坛][1]
13+
: Ruby 的简体中文论坛
14+
15+
[Ruby 用户组](user-groups/)
16+
: 你的本地用户组是一个能让你在网络上与其他 Ruby 程序员进行交流的地方。Ruby
17+
用户组是自主管理的,通常设置有月度集会、邮件列表、Web站点,并且如果你幸运的话,还会时不时的举办代码节(codefest)。
18+
19+
[Ruby 邮件列表和新闻组](mailing-lists/)
20+
: Ruby 拥有一个由不同话题不同语言组成的列表目录。如果你有关于 Ruby 的问题,在邮件列表上进行提问是一个获得答案的好方法。
21+
22+
[Ruby 在 IRC 上](irc://irc.freenode.net/ruby-lang)
23+
: 在 Ruby 语言 IRC 频道上,你可以与其他 Ruby 同道者进行畅谈。 ([先前的聊天记录][2])
24+
25+
[Ruby 核心](ruby-core/)
26+
: 随着Ruby 2.0在向我们逐渐走来,现在是一个追随 Ruby 发展的绝好时机。如果你对帮助 Ruby 的发展有兴趣,请从这里开始。
27+
28+
[关于 Ruby 的网络日志](weblogs/ "Weblog")
29+
: 在 Ruby 社区中,没有什么事情不会在 Blog 上被谈起。在这里我们有一份细致的建议表等着你去插入新条目。
30+
31+
[Ruby 会议](conferences/)
32+
: 遍及世界的 Ruby 程序员正在参与越来越多的会议,在会议上他们一起分享工作成果,讨论 Ruby 的未来并且欢迎新成员加入到 Ruby
33+
社区。
34+
35+
[Ruby 导师计划][3]
36+
: 这个新的资源目的就是要在新接触 Ruby 的初学者和富有经验的向导之间建立联系。最终通过导师的指导,使 Ruby
37+
的学习过程变得轻松。这个为初学着开设的栏目能让他们觉得在这里提问比在邮件列表中更轻松更自信,虽然 Ruby Talk 非常欢迎初学者的提问
38+
39+
Ruby 的一般信息
40+
: * [Ruby Central][4]
41+
* [Ruby at Open Directory Project][5]
42+
* [Rails at Open Directory Project][6]
43+
44+
45+
46+
[1]: http://www.ruby-lang.org.cn/forums/
47+
[2]: http://meme.b9.com/
48+
[3]: http://rubymentor.rubyforge.org/
49+
[4]: http://www.rubycentral.org/
50+
[5]: http://dmoz.org/Computers/Programming/Languages/Ruby/
51+
[6]: http://dmoz.org/Computers/Programming/Languages/Ruby/Software/Rails/

0 commit comments

Comments
 (0)