module RCoLi::Help

Public Instance Methods

help(*args) click to toggle source
# File lib/rcoli/help.rb, line 7
def help(*args)
  if args[0].empty?
    puts template('help', nil)
  else
    command = self
    args[0].each do |arg| 
      command = command.find_command(arg)
      raise InvalidCommand, "'#{arg}' is not a valid #{@name} command" unless command
    end
    puts template('help_command', command)
  end
end
template(name, command) click to toggle source
# File lib/rcoli/help.rb, line 20
def template(name, command)
  ERB.new(File.read(File.join(File.dirname(__FILE__), 'templates', "#{name}.erb")), nil, '-').result binding
end