method

help

Importance_0
v2_5_5 - Show latest stable - 0 notes - Class: UN
help(argv, output: $stdout) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/un.rb, line 368
  def help(argv, output: $stdout)
    all = argv.empty?
    cmd = nil
    if all
      store = proc {|msg| output << msg}
    else
      messages = {}
      store = proc {|msg| messages[cmd] = msg}
    end
    open(__FILE__) do |me|
      while me.gets("##\n")
        if help = me.gets("\n\n")
          if all or argv.include?(cmd = help[/^#\s*ruby\s.*-e\s+(\w+)/, 1])
            store[help.gsub(/^# ?/, "")]
            break unless all or argv.size > messages.size
          end
        end
      end
    end
    if messages
      argv.each {|arg| output << messages[arg]}
    end
  end
Register or log in to add new notes.