Module: RDoc

Defined in:
lib/saikuro/usage.rb

Class Method Summary collapse

Class Method Details

.main_program_file=(file) ⇒ Object



8
9
10
# File 'lib/saikuro/usage.rb', line 8

def RDoc.main_program_file=(file)
  @@main_program_file = file
end

.usage_no_exit(*args) ⇒ Object

Display usage



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/saikuro/usage.rb', line 13

def RDoc.usage_no_exit(*args)
  @@main_program_file ||= caller[-1].sub(/:\d+$/, '')
  comment = File.open(@@main_program_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

  options = RI::Options.instance
  if args = ENV["RI"]
    options.parse(args.split)
  end
  formatter = options.formatter.new(options, "")
  formatter.display_flow(flow)
end