Skip to content

Commit e91d41c

Browse files
committed
Fix parsing of superclasses in CRuby docs
Fixes #1079
1 parent 46d638a commit e91d41c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/yard/handlers/c/class_handler.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class YARD::Handlers::C::ClassHandler < YARD::Handlers::C::Base
2121
handle_class(var_name, class_name, parent)
2222
end
2323
statement.source.scan(MATCH2) do |var_name, in_module, class_name, parent|
24-
handle_class(var_name, class_name, parent, in_module)
24+
handle_class(var_name, class_name, parent.strip, in_module)
2525
end
2626
end
2727
end

spec/handlers/c/class_handler_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
it "registers classes under namespaces" do
1111
parse_init <<-EOF
1212
cBar = rb_define_class("Bar", rb_cObject);
13-
cFoo = rb_define_class_under(cBar, "Foo", rb_cObject);
13+
cFoo = rb_define_class_under( cBar, "Foo", rb_cBaz );
1414
EOF
1515
expect(Registry.at('Bar::Foo').type).to eq :class
16+
expect(Registry.at('Bar::Foo').superclass.path).to eq 'Baz'
1617
end
1718

1819
it "remembers symbol defined with class" do

0 commit comments

Comments
 (0)