Seeing code like this makes my teeth ache:
@michaelfromuk some other ones I've seen:
# YAML.load_file exists for this
# was only necessary before the URI() method was added
@michaelfromuk sometimes I try to understand the reasoning for that kind of code was. Sometimes the context gets lots with the churn, other it's excessive pragmatism.
In that particular case it looks like they try to avoid the infamous 'Undefined method 'starts_with?` for Nil class' and also making the sentence shorter (cool?); instead of guard it,
return false if key.nil? # blank?
or using a slower regex
if key ~= /AXYZ/
Not sure, archeology solves the mystery.
A Mastodon instance for Rubyists & friends