Skip to content

Commit

Permalink
Merge pull request #505 from now/list-includes-in-correct-order
Browse files Browse the repository at this point in the history
Fix mixin order of multiple arguments to include
  • Loading branch information
lsegal committed Apr 22, 2012
2 parents b2be257 + 44b291a commit e96d9f1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/yard/handlers/ruby/mixin_handler.rb
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion spec/handlers/examples/mixin_handler_001.rb.txt
Expand Up @@ -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
Expand All @@ -30,4 +34,4 @@ module ABC
include ABC::BAR
end
end
end
end
4 changes: 4 additions & 0 deletions spec/handlers/mixin_handler_spec.rb
Expand Up @@ -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")]
Expand Down
2 changes: 1 addition & 1 deletion spec/templates/examples/module001.txt
Expand Up @@ -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:
Expand Down

0 comments on commit e96d9f1

Please sign in to comment.