是否有教程教授经验丰富的程序员使用的常见 Ruby 编程习惯,但对新手来说可能不太明显?

发布于 2024-07-05 15:44:45 字数 652 浏览 8 评论 0原文

我正在寻找 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

一世旳自豪 2024-07-12 15:44:45

我推荐常年经典: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.

最丧也最甜 2024-07-12 15:44:45

这是一个幻灯片:惯用的 Ruby

摘录:

until”的工作方式类似于“while not

  x = x * 2 until x > 100

Here's a slideshow: Idiomatic Ruby.

Excerpt:

'until' works like 'while not'

  x = x * 2 until x > 100
以往的大感动 2024-07-12 15:44:45

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.

逆光下的微笑 2024-07-12 15:44:45

查看 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.

时光是把杀猪刀 2024-07-12 15:44:45

虽然不是直接的教程,但您可以在以下主题中找到一个博客:

http://its.arubything.com/

While not directly a tutorial, here is a blog that you'll find on topic

http://its.arubything.com/

慵挽 2024-07-12 15:44:45

先生怎么样? Neigborly 的《简陋的红宝石小书》

摘录:

IO.foreach("textfile.txt") {|line| puts line }

How about Mr. Neigborly's Humble Little Ruby Book

Excerpt:

IO.foreach("textfile.txt") {|line| puts line }
倦话 2024-07-12 15:44:45

理解 Ruby 闭包的可执行指南,closures-in-ruby.rb

An executable guide to understanding Ruby's closures, closures-in-ruby.rb.

饭团 2024-07-12 15:44:45

我最近发现了这个博客。 还没有真正深入了解它,我读过的几篇文章都有点侧重于初学者。
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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文