I have to clean up a object in Ruby, and the way I have been doing that is by cloning a hash, and modifying an original. This was my original method:

```
def remove_empty_stories(content)
    content.clone.each do |section,stories|
        for i in 0...stories.length do
            if stories[i].length < 25
          content[section].delete_at(i)
            end
        end
    end
    content
end

```

But I've had a thought that it would be a better idea to rather build up a new hash out of acceptable values from the old hash. Is this a correct assumption?

Am I right in thinking that this would be a 'functional' style?

An example of what content might look like before:

```
content = {
  :GENERAL_STORIES => [
    'Story 1',
    'Story 2',
    '',
    'Story 3',
    etc,
  ],
  :GOLD_STORIES => [
    'Story 1',
    'Story 2',
    'Story 3',
    '',
    '',
    etc
  ],
  etc.
}

```

And what I found with the above method is that if I remove a story then it shortens the array, but the iterator still counts to the original length (and the error I got was that .length cannot be applied to nil or something)