Let assume I have a classes A
and B
where B
inherits A
. How do I print parent class name in B
class A
end
class B < A
end
Some things I have tried:
>> B.new.class #=> B #which is correct
>> B.new.parent #=> Undefined method `parent`
>> B.parent #=> Object
>> B.parent.class #=> Class
class A
end
class B < A
end
B.superclass # => A
B.superclass.name # => "A"