Class: HelpPrinter
- Inherits:
-
Object
- Object
- HelpPrinter
- Defined in:
- lib/cl/magic/dk/help_printer.rb
Instance Method Summary collapse
-
#initialize(logger) ⇒ HelpPrinter
constructor
A new instance of HelpPrinter.
- #print_dk_help_line(key, help) ⇒ Object
Constructor Details
#initialize(logger) ⇒ HelpPrinter
Returns a new instance of HelpPrinter.
4 5 6 |
# File 'lib/cl/magic/dk/help_printer.rb', line 4 def initialize(logger) @logger = logger end |
Instance Method Details
#print_dk_help_line(key, help) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cl/magic/dk/help_printer.rb', line 8 def print_dk_help_line(key, help) if $stdout.isatty if help.nil? @logger.puts("#{key.ljust(15, ' ')} ???no help???") else key = key.ljust(15, ' ') help_parts = help.split(";") # first line @logger.puts(key, help_parts.shift) # following lines padding = "".ljust(15, ' ') help_parts.each do |p| @logger.puts(padding, p) end @logger.puts("") if help.end_with?(";") end end end |