I need get constant name from this:
class Sex
Male = 1
Female = 2
end
But this is perfect variant, can i get constant name at least from this:
class Sex
self.Male = 1
self.Female = 2
end
Few details about the problem:
- You can get a list of methods:
Class.methods - Object.methods
- You can get a list of instance variables:
instance_variables.map{|ivar| instance_variable_get ivar}
- You can get a list of constant names from Module:
Module.constants
But i have no idea how I can get class constant names.
Aucun commentaire:
Enregistrer un commentaire