This might be more clear if it's formatted as a heredoc and restructured, like so

```ruby

resource_name = aliases.shift
aliases = aliases.map { |alias| "'" + alias + "'" }.join(", ")

str = <<-MANIFEST
  host { '#{resource_name}':
    host_aliases => [#{aliases}],
  }  
MANIFEST

This splits up the logic of formatting the data fields, and then laying out the resource.