Sha256: bac287266f991cb0be8ae07c1568ae15e8540a84929c75f3218529b649b94817

Contents?: true

Size: 1005 Bytes

Versions: 5

Compression:

Stored size: 1005 Bytes

Contents

include T('default/module')

def init
  super
  sections.place(:subclasses).before(:children)
  sections.place([:constructor_details, [T('method_details')]]).before(:methodmissing)
end

def constructor_details
  ctors = object.meths(:inherited => true, :included => true)
  return unless @ctor = ctors.find {|o| o.name == :initialize }
  return if prune_method_listing([@ctor]).empty?
  erb(:constructor_details)
end

def subclasses
  return if object.path == "Object" # don't show subclasses for Object
  if !defined? @@subclasses
    @@subclasses = {}
    list = run_verifier Registry.all(:class)
    list.each do |o| 
      (@@subclasses[o.superclass.path] ||= []) << o if o.superclass
    end
  end
  
  @subclasses = @@subclasses[object.path]
  return if @subclasses.nil? || @subclasses.empty?
  @subclasses = @subclasses.sort_by {|o| o.path }.map do |child|
    name = child.path
    if object.namespace
      name = object.relative_path(child)
    end
    [name, child]
  end
  erb(:subclasses)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yard-0.5.8 templates/default/class/setup.rb
yard-0.5.7 templates/default/class/setup.rb
yard-0.5.6 templates/default/class/setup.rb
yard-0.5.5 templates/default/class/setup.rb
yard-0.5.4 templates/default/class/setup.rb