An example of procedural code made beautiful through object thinking.
Take this top-down, procedural code:
@rules = @event.rules.reject { |rule| rule.id.eql?(@rule.id) }
What’s it doing? It’s returning a list of rules belonging to an object that are not the current rule. In other words, it’s returning all rules but one, specified by some argument.
While the code is not incredibly difficult, it could be easier. And easier is [...]



