How can I find a class name given its instance variables? For example, given the class below:
class Student
attr_accessor :name
end
and, the object below:
student = Student.new
student.name = "John Doe"
How can I get the class name (or its Class object) from the instance variable name of the student object?
Aucun commentaire:
Enregistrer un commentaire