I frequently write something like this:
a_hash[\'x\'] ? a_hash[\'x\'] += \' some more text\' : a_hash[\'x\'] = \'first text\'
There ought to be
In case you do not want to mess with the default= value (existing hash), you can shorten your code by using fetch(key [, default]) as a look-up with a default value:
default=
fetch(key [, default])
a_hash['x'] = a_hash.fetch('x', 'first_text') + ' some more text'