Sha256: 8a51b3c4b57f082a600e132a9327e5b931aa5aaba5c2acb43cc19b630e530daa

Contents?: true

Size: 844 Bytes

Versions: 2

Compression:

Stored size: 844 Bytes

Contents

# This is a patch to RDoc so that when saikuro is installed as a
# RubyGem usage will read the proper file.

module RDoc

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

  # Display usage
  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
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
metric_fu-Saikuro-1.1.1.0 lib/saikuro/usage.rb
japgolly-Saikuro-1.1.1.0 lib/saikuro/usage.rb