class RDoc::Stats
def add_alias(as)
def add_alias(as) @display.print_alias as @num_methods += 1 @nodoc_methods += 1 if as.document_self and as.comment.empty? end
def add_class(klass)
def add_class(klass) @display.print_class klass end
def add_constant(constant)
def add_constant(constant) @display.print_constant constant @num_constants += 1 @nodoc_constants += 1 if constant.document_self and constant.comment.empty? end
def add_file(file)
def add_file(file) @display.print_file @num_files, file @num_files += 1 end
def add_method(method)
def add_method(method) @display.print_method method @num_methods += 1 @nodoc_methods += 1 if method.document_self and method.comment.empty? end
def add_module(mod)
def add_module(mod) @display.print_module mod end
def begin_adding
def begin_adding @display.begin_adding end
def done_adding
def done_adding @display.done_adding end
def initialize(total_files, verbosity = 1)
def initialize(total_files, verbosity = 1) @nodoc_constants = 0 @nodoc_methods = 0 @num_constants = 0 @num_files = 0 @num_methods = 0 @total_files = total_files @start = Time.now @display = case verbosity when 0 then Quiet.new total_files when 1 then Normal.new total_files else Verbose.new total_files end end
def print
def print classes = RDoc::TopLevel.classes num_classes = classes.length nodoc_classes = classes.select do |klass| klass.document_self and klass.comment.empty? end.length modules = RDoc::TopLevel.modules num_modules = modules.length nodoc_modules = modules.select do |mod| mod.document_self and mod.comment.empty? end.length items = num_classes + @num_constants + num_modules + @num_methods doc_items = items - nodoc_classes - @nodoc_constants - nodoc_modules - @nodoc_methods percent_doc = doc_items.to_f / items * 100 puts "Files: %5d" % @num_files puts "Classes: %5d (%5d undocumented)" % [num_classes, nodoc_classes] puts "Constants: %5d (%5d undocumented)" % [@num_constants, @nodoc_constants] puts "Modules: %5d (%5d undocumented)" % [num_modules, nodoc_modules] puts "Methods: %5d (%5d undocumented)" % [@num_methods, @nodoc_methods] puts "%6.2f%% documented" % percent_doc puts puts "Elapsed: %0.1fs" % (Time.now - @start) end