lib/yard/handlers/ruby/mixin_handler.rb in yard-0.9.20 vs lib/yard/handlers/ruby/mixin_handler.rb in yard-0.9.21
- old
+ new
@@ -30,8 +30,20 @@
obj = Proxy.new(namespace, obj.value, :module)
else
obj = Proxy.new(namespace, mixin.source, :module)
end
- namespace.mixins(scope).unshift(obj) unless namespace.mixins(scope).include?(obj)
+ rec = recipient(mixin)
+ return if rec.nil? || rec.mixins(scope).include?(obj)
+ rec.mixins(scope).unshift(obj)
+ end
+
+ def recipient(mixin)
+ if statement[0].type == :var_ref && statement[0][0] != s(:kw, "self")
+ statement[0][0].type == :const ?
+ Proxy.new(namespace, statement.namespace.source) :
+ nil
+ else
+ namespace
+ end
end
end