You can split the array %w[]and put nilafter:
>> array = [ *%w[one two], nil, *%w[and some more words] ]
=> ["one", "two", nil, "and", "some", "more", "words"]
But it can be noisier than just specifying the lines individually; OTOH, the extra noise indicates that something strange is happening, so readers will be asked to get close to them.
source
share