Parent

Class/Module Index [+]

Quicksearch

YARD::CLI::Stats

@since 0.6.0

Constants

STATS_ORDER

Maintains the order in which stats_for_ statistics methods should be printed.

@see print_statistics

Attributes

parse[RW]

@return [Boolean] whether to parse and load registry

Public Class Methods

new(parse = true) click to toggle source

@param [Boolean] parse whether to parse and load registry (see {parse})

# File lib/yard/cli/stats.rb, line 17
def initialize(parse = true)
  super()
  @parse = parse
  @undoc_list = nil
  @compact = false
end

Public Instance Methods

all_objects() click to toggle source

@return [Array<CodeObjects::Base>] all the parsed objects in the registry,

removing any objects that are not visible (private, protected) depending
on the arguments passed to the command.
# File lib/yard/cli/stats.rb, line 99
def all_objects
  @all_objects ||= run_verifier Registry.all
end
description() click to toggle source
# File lib/yard/cli/stats.rb, line 24
def description
  "Prints documentation statistics on a set of files"
end
output(name, data, undoc = nil) click to toggle source

Prints a statistic to standard out. This method is optimized for getting Integer values, though it allows any data to be printed.

@param [String] name the statistic name @param [Integer, String] data the numeric (or any) data representing

the statistic. If +data+ is an Integer, it should represent the
total objects of a type.

@param [Integer, nil] undoc number of undocumented objects for the type @return [void]

# File lib/yard/cli/stats.rb, line 143
def output(name, data, undoc = nil)
  @total += data if data.is_a?(Integer) && undoc
  @undocumented += undoc if undoc.is_a?(Integer)
  if undoc
    data = ("%5s (% 5d undocumented)" % [data, undoc])
  else
    data = "%5s" % data
  end
  log.puts("%-12s %s" % [name + ":", data])
end
run(*args) click to toggle source

Runs the commandline utility, parsing arguments and generating output if set.

@param [Array<String>] args the list of arguments @return [void]

# File lib/yard/cli/stats.rb, line 33
def run(*args)
  parse_arguments(*args)

  if use_cache
    Registry.load!
  elsif parse
    YARD.parse(files, excluded)
    Registry.save(use_cache) if save_yardoc
  end

  print_statistics
  print_undocumented_objects
end
stats_for_classes() click to toggle source

Statistics for classes

# File lib/yard/cli/stats.rb, line 116
def stats_for_classes
  output "Classes", *type_statistics(:class)
end
stats_for_constants() click to toggle source

Statistics for constants

# File lib/yard/cli/stats.rb, line 121
def stats_for_constants
  output "Constants", *type_statistics(:constant)
end
stats_for_files() click to toggle source

Statistics for files

# File lib/yard/cli/stats.rb, line 104
def stats_for_files
  files = []
  all_objects.each {|o| files |= [o.file] }
  output "Files", files.size
end
stats_for_methods() click to toggle source

Statistics for methods

# File lib/yard/cli/stats.rb, line 126
def stats_for_methods
  objs = all_objects.select {|m| m.type == :method }
  objs.reject! {|m| m.is_alias? || !m.is_explicit? }
  undoc = objs.select {|m| m.docstring.blank? && !m.overridden_method }
  @undoc_list |= undoc if @undoc_list
  output "Methods", objs.size, undoc.size
end
stats_for_modules() click to toggle source

Statistics for modules

# File lib/yard/cli/stats.rb, line 111
def stats_for_modules
  output "Modules", *type_statistics(:module)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.