diff --git a/CHANGELOG.md b/CHANGELOG.md index d98e798..f6c6ea8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ - Look at 2nd argument when checking for `rb_self` to infer the scope (class/instance) method (in addition to the 1st arg). This is because magnus can inject a `magnus::Ruby` as the 1st argument. +- Ensure nested constants (`A::B`) show up in YARD's class list, + regardless of which order they're in rustdoc's JSON. ## v0.3.2 diff --git a/lib/yard-rustdoc/parser.rb b/lib/yard-rustdoc/parser.rb index b6b7f87..e3ef8c8 100644 --- a/lib/yard-rustdoc/parser.rb +++ b/lib/yard-rustdoc/parser.rb @@ -51,6 +51,9 @@ def parse @entries << Statements::Struct.new(entry, methods) end + # Ensure Foo comes before Foo::Bar + @entries.sort! { |a, b| a.name <=> b.name } + self end