Module: RDoc
- Defined in:
- lib/rdoc_patch.rb
Class Method Summary collapse
-
.usage_from_file(input_file, *args) ⇒ Object
Display usage from the given file.
Instance Method Summary collapse
-
#usage_no_exit(*args) ⇒ Object
Force the use of comments in this file so RDoc::usage works even when invoked from a proxy (e.g. ‘resat’ bash script).
Class Method Details
.usage_from_file(input_file, *args) ⇒ Object
Display usage from the given file
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rdoc_patch.rb', line 17 def RDoc.usage_from_file(input_file, *args) comment = File.open(input_file) do |file| find_comment(file) end comment = comment.gsub(/^\s*#/, '') markup = SM::SimpleMarkup.new flow_convertor = SM::ToFlow.new flow = markup.convert(comment, flow_convertor) format = "plain" unless args.empty? flow = extract_sections(flow, args) end = RI::Options.instance if args = ENV["RI"] .parse(args.split) end formatter = .formatter.new(, "") formatter.display_flow(flow) end |
Instance Method Details
#usage_no_exit(*args) ⇒ Object
Force the use of comments in this file so RDoc::usage works even when invoked from a proxy (e.g. ‘resat’ bash script)
11 12 13 14 |
# File 'lib/rdoc_patch.rb', line 11 def usage_no_exit(*args) main_program_file = caller[-1].sub(/:\d+$/, '') usage_from_file(main_program_file) end |