File: setup.rb

package info (click to toggle)
yard 0.9.37-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 5,720 kB
  • sloc: ruby: 31,354; javascript: 7,608; makefile: 21
file content (27 lines) | stat: -rw-r--r-- 744 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true
include Helpers::ModuleHelper

def init
  sections :header, [T('docstring')], :method_list, [T('method')]
end

def method_list
  @meths = object.meths(:inherited => false, :included => false)
  cons = @meths.find(&:constructor?)
  @meths = @meths.reject {|meth| special_method?(meth) }
  @meths = sort_listing(prune_method_listing(@meths, false))
  @meths.unshift(cons) if cons
  erb(:method_list)
end

def sort_listing(list)
  list.sort_by {|o| [o.scope.to_s, o.name.to_s.downcase] }
end

def special_method?(meth)
  return true if meth.writer? && meth.attr_info[:read]
  return true if meth.name(true) == 'new'
  return true if meth.name(true) == '#method_missing'
  return true if meth.constructor?
  false
end