[Patch] Correct "Parent" for classes
Quintus opened this issue · comments
Hi there,
In the documentation for classes and modules, hanna shows a "parent" attribute at the top, like this:
CLASS Foo
foo.rb
Parent: foo.rb
I think that "parent" once was to be meant as "superclass" because it doesn't make sense to list the definition file twice. I wrote a patch that does the following:
- Show "Parent" only for real classes, not modules
- Use the
superclass
method instead ofparent
to get the real code parent
Here's the patch:
--- a/lib/hanna-nouveau/template_files/page.haml
+++ b/lib/hanna-nouveau/template_files/page.haml
@@ -26,11 +26,14 @@
%li
%a.show{ :href => '#', :onclick => 'this.parentNode.parentNode.className += " expanded"; this.parentNode.removeChild(this); return false' } show all
- - if values[:entry].parent
+ - if !file_page && values[:entry].type == "class"
.parent
Parent:
-# FIXME helper method
- %strong= link_to values[:entry].parent.name, Pathname.new(class_dir) + Pathname.new(values[:entry].parent.path).relative_path_from(Pathname.new values[:
+ - if values[:entry].superclass.kind_of?(String)
+ %strong= values[:entry].superclass
+ - else
+ %strong= link_to values[:entry].superclass.name, Pathname.new(class_dir) + Pathname.new(values[:entry].superclass.path).relative_path_from(Pathname.ne
- if values[:entry].respond_to?(:last_modified) and values[:entry].last_modified
.last-update
Thanks for consideration.
Vale,
Marvin
Ah you're probably right. I can't evaluate this patch right now, but I will try to make time this evening.
Parent is currently the class, module, or file (if defined at top level) inside which this class/module was defined. This is generally separate from the superclass. This change may still be a good idea, but we should probably change the label from Parent to Superclass if it is applied.