initializing hashes

Posted by Paul on Stack Overflow See other posts from Stack Overflow or by Paul
Published on 2010-06-07T15:30:19Z Indexed on 2010/06/07 15:42 UTC
Read the original article Hit count: 183

Filed under:
|

Seems like I am frequently writing something like this...

a_hash['x'] ? a_hash['x'] += ' some more text' : a_hash['x'] = 'first text'

seems like there ought to be a better way, but I can't find it.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about hash