templates/default/module/setup.rb in yard-0.4.0 vs templates/default/module/setup.rb in yard-0.5.0
- old
+ new
@@ -19,31 +19,33 @@
@inner = [[:modules, []], [:classes, []]]
object.children.each do |child|
@inner[0][1] << child if child.type == :module
@inner[1][1] << child if child.type == :class
end
+ @inner.map! {|v| [v[0], run_verifier(v[1].sort_by {|o| o.name.to_s })] }
return if (@inner[0][1].size + @inner[1][1].size) == 0
- @inner.map! {|v| [v[0], v[1].sort_by {|o| o.name.to_s }] }
erb(:children)
end
def methodmissing
mms = object.meths(:inherited => true, :included => true)
return unless @mm = mms.find {|o| o.name == :method_missing && o.scope == :instance }
erb(:methodmissing)
end
def method_listing(include_specials = true)
- return @smeths ||= method_listing.reject {|o| special_methods.include? o.name(true) } unless include_specials
+ return @smeths ||= method_listing.reject {|o| special_method?(o) } unless include_specials
return @meths if @meths
@meths = object.meths(:inherited => false, :included => false)
@meths = sort_listing(prune_method_listing(@meths))
@meths
end
-def special_methods
- ["#initialize", "#method_missing"]
+def special_method?(meth)
+ return true if meth.name(true) == '#method_missing'
+ return true if meth.constructor?
+ false
end
def attr_listing
return @attrs if @attrs
@attrs = []
@@ -62,11 +64,11 @@
@constants = run_verifier(@constants)
@constants
end
def sort_listing(list)
- list.sort_by {|o| [o.scope, (options[:visibilities]||[]).index(o.visibility), o.name].join(":") }
+ list.sort_by {|o| [o.scope.to_s, o.name.to_s.downcase] }
end
def docstring_summary(obj)
docstring = ""
if obj.tags(:overload).size == 1 && obj.docstring.empty?
@@ -78,6 +80,13 @@
if docstring.summary.empty? && obj.tags(:return).size == 1 && obj.tag(:return).text
docstring = Docstring.new(obj.tag(:return).text.gsub(/\A([a-z])/) {|x| x.upcase }.strip)
end
docstring.summary
+end
+
+def scopes(list)
+ [:class, :instance].each do |scope|
+ items = list.select {|m| m.scope == scope }
+ yield(items, scope) unless items.empty?
+ end
end