Person = Struct.new(:name,:value) do
  def to_s;  end
end

list = [Person.new(,3),
        Person.new(,4),
        Person.new(,20),
        Person.new(,3)]
puts list.sort_by{|x|x.name}
puts
puts list.sort_by(&:value)