|
|
|
|
|
by deadbadger
5538 days ago
|
|
On the subject of try() chaining, there's always Ick, which implements (among other things) a kind of Maybe monad for Ruby. This acts as a self-propagating nil guard, so you're able to write things like: maybe(Person.find("geoff")) { |person| person.manager.authority_level.permissions }
without worrying about chaining things yourself. I've not used it in production code yet, as I haven't really had a chance to do due diligence on it - be interested to hear if anyone else has used it in anger...http://ick.rubyforge.org/ |
|