T S Vallender

ruby

Just used “ensure” in Ruby exception handling for—I think—the first time. Immediately got confused by it! Even if it’s the last thing occurring in a method, the last line isn’t the return value of the method unless you explicitly return it. I presume things are getting handed back up the stack in a way that loses the value, but should investigate the behaviour to understand it when I have time.
Tags:
Read through Avdi Grimm’s Exceptional Ruby. I don’t think there was much in there new to me but it cemented a few things and touched on some more obscure nuggets I’ve not come across before.
Tags:
I'm not a fan of most of RSpec's DSL, so appreciated this article from Test Double suggesting the use of Ruby 3's endless method syntax instead of using let.

def foo = bar.new
instead of
let foo { bar.new }

Not considered that before, and combined with using instance variables instead of let!, it reinforces and makes more obvious the difference.
Tags:
Signed up for First Ruby Friend after Brighton Ruby and have just been matched to someone! First chat tomorrow.
Tags: