Making Ruby Yours

Pulling at a Loose Thread

One day I noticed an inconsistency as I was joining together lists of words. Consider this no-delimiter join:

arr = [ ['some', 'lists'], ['of', 'different', 'words'] ] arr.map(&:join) # => ['somelists', 'ofdifferentwords']

It’s point-free and clean, aside from the funny ampersand.


DZone Web Dev Zone

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.