Class: Commander::HelpFormatter::Base
- Defined in:
- lib/commander/help_formatters/base.rb
Overview
Base class for help formatters. Subclasses receive the Commander::Runner instance being documented and must implement #render (global help) and #render_command (per-command help). This base implementation renders placeholder text and exists mainly for testing and as a minimal example.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(runner) ⇒ Base
constructor
A new instance of Base.
-
#render ⇒ Object
Render the global help text shown for --help with no command, or the
helpcommand with no arguments. -
#render_command(command) ⇒ Object
Render the help text for a single command.
Constructor Details
#initialize(runner) ⇒ Base
Returns a new instance of Base.
12 13 14 |
# File 'lib/commander/help_formatters/base.rb', line 12 def initialize(runner) @runner = runner end |
Instance Method Details
#render ⇒ Object
Render the global help text shown for --help with no
command, or the help command with no arguments.
19 20 21 |
# File 'lib/commander/help_formatters/base.rb', line 19 def render 'Implement global help here' end |
#render_command(command) ⇒ Object
Render the help text for a single command.
25 26 27 |
# File 'lib/commander/help_formatters/base.rb', line 25 def render_command(command) "Implement help for #{command.name} here" end |