百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
B

best-ruby

> 编程语言
开源

Ruby 诀窍、习惯用法、重构和最佳实践

2.4K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

Ruby 诀窍、习惯用法、重构和最佳实践

Ruby Tricks, Idiomatic Ruby, Refactorings and Best Practices

Do you know why experienced Ruby programmers tend to reach for basic collections and hashes while programmers from other languages go for more specialized classes? Do you know the difference between strip, chop, and chomp; and why there are three such similar methods when apparently one might suffice (Not to mention lstrip and rstrip!)? Do you know the downsides of dynamic typing? Do you know why the differences between strings and symbols get so blurry, even to experienced Ruby developers? How about metaprogramming? What the heck is an eigenclass? How about protected methods? Do you know what they’re really about? Really? Are you sure? Eloquent Ruby

Absolutely the best way to learn to write idiomatic Ruby code is to read idiomatic Ruby code. Eloquent Ruby

This repository aims to help everyone write more idiomatic, clean, and tricky ruby code and also document good refactoring techniques. You can add your own technique or paste it from some website. Do not forget the source, of course. All the tricks are in the /tricks folder.

For the sake of clarity, you should paste in the markdown format. At the end, if the code is not your own, paste a reference to the author and source of the technique.

Tricks

In this part we can review some obscure or awesome features from the and the standard ruby library which we normally forget.

Idiomatic Ruby

You can write Ruby code, but it can sometimes look like Java code. Here you can find some tips to write more naturally and take advantage of idiomatic Ruby.

Refactorings

Small (and big) improvements you can apply to your code and improve it's readability and maintenance. Change the internal structure of the code without changing it's behaviour.

Best Practices

If you keep your house cleaned constantly you'll never need to waste a weekend cleaning it. The same applies to your code. Be disciplined and keep your code looking good with those tips.

Contributors

A big thanks to the following people

Contributing

  1. Fork it
  2. Create a branch with your idea: git checkout -b my-idea
  3. Check in which category it should be: best practice, idiomatic ruby, refactoring or trick. If you don't know, please open an issue and ask.
  4. Add your idea to the collection of .md files in the correct folder (tricks, refactorings, idiomatic_ruby or best_practices) folder
  5. Commit your changes: git commit -am 'Add my idea'
  6. Push to the branch: git push origin my-idea
  7. Create a new Pull Request and explain your technique in the markdown file

GitHub Issues· 0 开放

在 GitHub 查看全部

暂无开放 Issues,或尚未同步最近议题。

核心特点

  • •Ruby

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言