Closed n1ec closed 1 year ago
I don't understand what you mean by 'getting ":super"'. The code you're parsing returns s(:class, :A, s(:const, :B))
. There is no :super
in there, so I'm confused.
What you're doing with the class_eval
and inspect
and your self.s
method... I don't know.
require 'ruby_parser'
class SillyRubyParserExample
def self.example
RubyParser.new.parse "class A < B; end"
end
end
pp SillyRubyParserExample.example
output:
% ruby -Ilib bug335.rb
s(:class, :A, s(:const, :B))
no response. closing.
require 'ruby_parser'
class SillyRubyParserExample
def self.example
RubyParser.new.parse "class A < B; end"
end
end
pp SillyRubyParserExample.example
Why isn't this B not super class?
My idea is to get B as super class I want to know that A inherits B
% ruby -Ilib bug335.rb
s(:class, :A, s(:super, :B))
I already showed you:
s(:class, :A, s(:const, :B))
Oh, sorry, I thought” :const”not :super
Hi,Can you provide an example of getting ":super"?