how to get names of instances/objects in ruby : I want to store only names of instances in array by a class method, when i try it returns to me whole instance when i put object_id  it returns to me integer identifier of my object, i just want name of instance in array and later with that array to sort object by its last_name thanks,this is what i tryed :

    class Person
        attr_accessor :name, :years, :height, :work, :last_name
        @@people=[]
        def initialize(name)
            @name=name
            @@people << self.object_id #WHAT TO TYPE HERE???
        end
    
        def <=> (other_person)  # to compare two people, use last names
          self.last_name <=> other_person.last_name
        end
    
        def self.number_of_instances
            return @@people
        end
    
    end                
    mike=Person.new("michael")
    mike.years=45
    mike.height=141
    mike.work="singer"
    mike.last_name="zux"
    
    bob=Person.new("boby")
    bob.years=29
    bob.height=150
    bob.work="soldier"
    bob.last_name="awax"
    
    steven=Person.new("stephan")
    steven.years=24
    steven.height=179
    steven.work="painter"
    steven.last_name="sigal"
    
    elena=Person.new("eli")
    elena.years=20
    elena.height=171
    elena.work="menager"
    elena.last_name="betany"
    a= Person.number_of_instances
    p a
    q= a.sort!{|first,second| first<=>second }
    p q

