class Player
  def initialize(name, id)
    @name, @id = name, id
  end
end

players = {
  "bob" => Player.new(:bob, "bob"),
  "zonbi" => Player.new(:zonbi, "zonbi"),
}

require "yaml"
File.open("names.yaml","wb") { |f| YAML.dump(players, f) }

p2 = File.open("names.yaml","rb") { |f| YAML.load(f) }
puts p2.size
p p2

This gives the following format for the players file:
---
zonbi: !ruby/object:Player
  id: zonbi
  name: :zonbi
bob: !ruby/object:Player
  id: bob
  name: :bob

I think the problem is the extra "---" you inserted in between the 
players.
-- 
Posted via http://www.ruby-forum.com/.