Just to give you a little ruby insight, I probably would have written this line like so

`options['metadata'] = metadata if metadata`

That being said there is nothing wrong with this.