Module: RCoLi::Help
- Included in:
- Program
- Defined in:
- lib/rcoli/help.rb
Instance Method Summary collapse
Instance Method Details
#help(*args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# 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) ⇒ Object
20 21 22 |
# 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 |