Sha256: d241a6c7e6bdcb1d353490ff15d5558b1d0f2f54ba15ec893b86ee3b77094d54

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true
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)
  @ctor = ctors.find(&:constructor?)
  return unless @ctor
  return if prune_method_listing([@ctor]).empty?
  erb(:constructor_details)
end

def subclasses
  return if object.path == "Object" # don't show subclasses for Object
  unless globals.subclasses
    globals.subclasses = {}
    list = run_verifier Registry.all(:class)
    list.each do |o|
      (globals.subclasses[o.superclass.path] ||= []) << o if o.superclass
    end
  end

  @subclasses = globals.subclasses[object.path]
  return if @subclasses.nil? || @subclasses.empty?
  @subclasses = @subclasses.sort_by(&:path).map do |child|
    name = child.path
    name = object.relative_path(child) if object.namespace
    [name, child]
  end
  erb(:subclasses)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yard-0.9.18 templates/default/class/setup.rb
yard-0.9.17 templates/default/class/setup.rb