You have attributes like "is supervisor". Maybe a Hash isn't the best 
way to do this. What about a custom class with its own attributes and 
links?

something like this:

class MyUser

  attr_accessor :name, :user_id, :supervisor_id, :is_supervisor, 
:supervisor

  def initialize( name, user_id, supervisor_id, is_supervisor )
    @name = name
    @user_id = user_id
    @supervisor_id = supervisor_id
    @is_supervisor = is_supervisor
  end

end

Then you just extract the data, create the class instances, and set the 
"supervisor" of each by finding the supervisor_id

a = File.read('test.txt').split($/).map{|s| 
s.split('|')[1..-1].map(&:strip)}

a.map! {|arr| MyUser.new( *arr ) }

a.each { |my_user| my_user.supervisor = a.find{ |user| user.user_id == 
my_user.supervisor_id } }

Now you have an Array of users, each with a link to their supervisor.

-- 
Posted via http://www.ruby-forum.com/.