diff --git a/lib/yard/handlers/ruby/mixin_handler.rb b/lib/yard/handlers/ruby/mixin_handler.rb index 0a38cc1c5..20afac013 100644 --- a/lib/yard/handlers/ruby/mixin_handler.rb +++ b/lib/yard/handlers/ruby/mixin_handler.rb @@ -5,7 +5,7 @@ class YARD::Handlers::Ruby::MixinHandler < YARD::Handlers::Ruby::Base process do errors = [] - statement.parameters(false).each do |mixin| + statement.parameters(false).reverse.each do |mixin| begin process_mixin(mixin) rescue YARD::Parser::UndocumentableError => err diff --git a/spec/handlers/examples/mixin_handler_001.rb.txt b/spec/handlers/examples/mixin_handler_001.rb.txt index a17457734..9fcd836f7 100644 --- a/spec/handlers/examples/mixin_handler_001.rb.txt +++ b/spec/handlers/examples/mixin_handler_001.rb.txt @@ -19,6 +19,10 @@ module Y class << self; include A; end end +module Z + include A, B +end + module ABC module FOO; end module DEF @@ -30,4 +34,4 @@ module ABC include ABC::BAR end end -end \ No newline at end of file +end diff --git a/spec/handlers/mixin_handler_spec.rb b/spec/handlers/mixin_handler_spec.rb index 378d03de5..7d8435f3a 100644 --- a/spec/handlers/mixin_handler_spec.rb +++ b/spec/handlers/mixin_handler_spec.rb @@ -32,6 +32,10 @@ it "should treat a mixed in Constant by taking its value as the real object name" do P(:Y).instance_mixins.should include(Registry.at('B::D')) end + + it "should add includes in the correct order when include is given multiple arguments" do + P(:Z).instance_mixins.should == [P(:A), P(:B)] + end it "should avoid including self for unresolved mixins of the same name" do P("ABC::DEF::FOO").mixins.should == [P("ABC::FOO")] diff --git a/spec/templates/examples/module001.txt b/spec/templates/examples/module001.txt index 2ec1a5b02..27fdd2b9e 100644 --- a/spec/templates/examples/module001.txt +++ b/spec/templates/examples/module001.txt @@ -16,7 +16,7 @@ Defined Under Namespace: Includes: --------- - A::B::C, F, E, D, B, BaseMod + D, E, F, A::B::C, B, BaseMod Class methods: