RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  

toch — 8 posts

When is your code DRY enough?
You're aware that duplicated code is a code smell. You know a couple of ways to dry it up, but it's not easy to know how much you should. When is it enough? That's the question I address in the blog post of today.
Strings are everywhere. They came from files, databases, REST APIs, or you simply use them to print results. But String comes with its own share of problems: how to deal with invalid byte sequence or convert back a String to a Date with an uncommon format. I share in a blog post 7 common use cases of String.
Array is so common in Ruby and well done (especially as a litteral) that it's usually the first choice as a collection. But sometimes we need to avoid duplicates, and we end to duplicate a lot of checks to do that. The post explains that use case and suggests a solution..
7 daily use cases of Ruby Hash
In that blog post, I share 7 use cases of Ruby Hash I met often. I hope it will be useful to you.

How to convert a JSON into a Hash?
How to convert a Hash into a JSON?
How to set default value for a nested Hash?
How to merge two nested Hashes?
How to filter out some keys of a Hash?
How to “sort” a Hash by value?
How to find the differences between two Hashes?
When you need to find how to check if one array has all elements of another, you won’t find the answer in the doc because it’s not use case oriented. The documentation explains what each piece can do, not how you can use it (and clearly not which you should use for a given use case). I share 7 common use cases of Array I met very often in a blog post: 7 daily use cases of Ruby Array.
A blog post introducing the product we're developing: PullReview, an Automated Code Review Tool for Ruby developers using GitHub.
A blog post how to refactor controller cluttered by a complex object creation in Ruby on Rails.
The blog post introduces what complexity is, how it can be measured, how to monitor it in Ruby, and how to reduce it in Ruby. The post is concluded with some thoughts and recap.

Did you say Complexity, eh?