是否有教程教授经验丰富的程序员使用的常见 Ruby 编程习惯,但对新手来说可能不太明显?
我正在寻找 Ruby 的等价物 Code Like a Pythonista: Idiomatic Python
理想的功能:
- 易于阅读的
- 单个文档,涵盖所有主题:提示、技巧、指南、警告和陷阱
- 大小小于一本书
- 习语应该在标准发行版中开箱即用(
% sudo apt-get install ruby irb rdoc
)
如果可能的话,请为每个答案放一个教程,并附上教程中的示例代码及其含义。
更新:
这些是我遇到过的最接近上述描述的资源:
- Ruby Idioms
- < a href="http://www.rubyist.net/~slagell/ruby/index.html" rel="nofollow noreferrer">Ruby 用户指南
I'm looking for a Ruby's equivalent of Code Like a Pythonista: Idiomatic Python
Desirable features:
- easy to read
- single document which covers all topics: tips, tricks, guidelines, caveats, and pitfalls
- size less than a book
- idioms should work out of the box for the standard distribution (
% sudo apt-get install ruby irb rdoc
)
Please, put one tutorial per answer if possible, with an example code from the tutorial and its meaning.
UPDATE:
These are the most closest to the above description resources I've encountered:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我推荐常年经典:Why's Poignant 指南
它既是对 Ruby 的介绍以及对 Ruby Way 的调查。
I would suggest the perennial classic: Why's Poignant guide
It's both an introduction to Ruby and an investigation into the Ruby Way.
这是一个幻灯片:惯用的 Ruby。
摘录:
“
until
”的工作方式类似于“while not
”Here's a slideshow: Idiomatic Ruby.
Excerpt:
'
until
' works like 'while not
'Ruby Idioms(最初来自 RubyGarden) 是我常用的习语参考。 它组织清晰并且相当完整。 正如作者所说,这些来自 RubyGarden,曾经非常酷(感谢Wayback Machine)。 但现在似乎离线。
Ruby Idioms (originally from RubyGarden) is my usual reference for idioms. It's clearly organized and fairly complete. As the author says, these are from RubyGarden, which used to be really cool (thanks Wayback Machine). But now seems to be offline.
查看 Ruby 方式 和 The Rails Way,它们不是教程,但我认为它们会涵盖您正在寻找的内容。
Check out The Ruby Way and The Rails Way, they aren't tutorials but I think they will cover what you're looking for.
虽然不是直接的教程,但您可以在以下主题中找到一个博客:
http://its.arubything.com/
While not directly a tutorial, here is a blog that you'll find on topic
http://its.arubything.com/
先生怎么样? Neigborly 的《简陋的红宝石小书》
摘录:
How about Mr. Neigborly's Humble Little Ruby Book
Excerpt:
理解 Ruby 闭包的可执行指南,closures-in-ruby.rb。
An executable guide to understanding Ruby's closures, closures-in-ruby.rb.
我最近发现了这个博客。 还没有真正深入了解它,我读过的几篇文章都有点侧重于初学者。
YMMV
http://blog.rubybestpractices.com/
I found this blog recently. Haven't really got into it yet and the couple of posts I have read were a bit beginner focussed.
YMMV
http://blog.rubybestpractices.com/