Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/bb/yard into mixin_list
Browse files Browse the repository at this point in the history
  • Loading branch information
lsegal committed Mar 22, 2010
2 parents 80050d6 + 70bcb8a commit 139e1b9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions templates/default/module/html/box_info.erb
Expand Up @@ -23,6 +23,13 @@
<% n = n == 2 ? 1 : 2 %>
<% end %>
<% end %>
<% [[:class, "Extending"], [:instance, "Included in"]].each do |scope, name| %>
<% if (mixed_into = mixed_into(object, scope)).size > 0 %>
<dt class="r<%=n%>"><%= name %>:</dt>
<dd class="r<%=n%>"><%= mixed_into.sort_by {|o| o.path }.map {|o| linkify(o) }.join(", ") %></dd>
<% n = n == 2 ? 1 : 2 %>
<% end %>
<% end %>
<% unless object.root? %>
<dt class="r<%=n%> last">Defined in:</dt>
<dd class="r<%=n%> last"><%= erb(:defines) %></dd>
Expand Down
14 changes: 14 additions & 0 deletions templates/default/module/setup.rb
Expand Up @@ -94,3 +94,17 @@ def scopes(list)
yield(items, scope) unless items.empty?
end
end

def mixed_into(object, scope)
if !defined? @@mixed_into
@@mixed_into = {:class => {}, :instance => {}}
@@mixed_into.keys.each do |scope|
list = run_verifier Registry.all(:class, :module)
list.each do |o|
o.mixins(scope).each { |mi| (@@mixed_into[scope][mi.path] ||= []) << o }
end
end
end

@@mixed_into[scope][object.path] || []
end

0 comments on commit 139e1b9

Please sign in to comment.