How we work

Prefer do end while creating blocks in ruby

We prefer using do..end instead of {} when using ruby blocks. {} is good when writing small one-liners or lambda, but using {} frequently makes code skewed as well as harder to read.

1all_users.select {|user| user.is_admin? && user.is_team_member? && user.can_view_new_team_feature? }

Now, let's see the do..end version:

1all_users.select do |user|
2  user.is_admin? && user.is_team_member? && user.can_view_new_team_feature?
3end

It's easier to read than the one-liner version, and can be further simplified as below:

1all_users.select do |user|
2  user.is_admin? &&
3  user.is_team_member? &&
4  user.can_view_new_team_feature?
5end