I am trying to get the name of the class from within a static method within the class:
class A
def self.get_class_name
self.class.name.underscore.capitalize.constantize
end
end
Though this returns Class instead of A. Any thoughts on how do I get A instead?
Eventually I also want to have a class B that inherits from A that will use the same method and will return B when called.
The reason I am doing this is because I have another object under this domain eventually: A::SomeOtherClass
which I want to use using the result I receive.
"A"
? – HowletA
or the name (string)"A"
? – Beckiebeckleyself
returns the class object andname
returns the class name. – Howlet