This looks to be more in the Java style (imperative) than the Ruby style (functional). Whenever you want to transform a collection in ruby, you generally use the Enumerable .collect or .map method to do so functionally:  

```ruby
return buck.objects.with_prefix(key).collect{ |obj| get_file(obj.key, key) }.reject{|obj| obj == ""}
```