Class: ActiveDoc::RdocGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/active_doc/rdoc_generator.rb

Class Method Summary collapse

Class Method Details

.for_method(base, method_name) ⇒ Object



3
4
5
6
7
# File 'lib/active_doc/rdoc_generator.rb', line 3

def self.for_method(base, method_name)
  if documented_method = ActiveDoc.documented_method(base, method_name)
    documented_method.to_rdoc
  end
end

.write_rdoc(source_file_path = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/active_doc/rdoc_generator.rb', line 9

def self.write_rdoc(source_file_path = nil)
  files_and_methods = ActiveDoc.documented_methods.sort_by { |x| x.origin_line }.group_by { |x| x.origin_file }
  files_and_methods.delete_if { |file| file != source_file_path } if source_file_path
  files_and_methods.each do |origin_file, documented_methods|
    offset = 0
    yield origin_file, documented_methods if block_given?
    documented_methods.each do |documented_method|
      offset = documented_method.write_rdoc(offset)
    end
  end
end