Class: Tomo::CLI::Usage
- Inherits:
-
Object
- Object
- Tomo::CLI::Usage
- Defined in:
- lib/tomo/cli/usage.rb
Instance Method Summary collapse
- #add_option(spec, desc) ⇒ Object
- #banner=(banner) ⇒ Object
-
#initialize ⇒ Usage
constructor
A new instance of Usage.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Usage
Returns a new instance of Usage.
6 7 8 9 |
# File 'lib/tomo/cli/usage.rb', line 6 def initialize @options = [] @banner_proc = proc { "" } end |
Instance Method Details
#add_option(spec, desc) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/tomo/cli/usage.rb', line 11 def add_option(spec, desc) << [ spec.start_with?("--") ? " #{spec}" : spec, desc ] end |
#banner=(banner) ⇒ Object
18 19 20 |
# File 'lib/tomo/cli/usage.rb', line 18 def () @banner_proc = .respond_to?(:call) ? : proc { } end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/tomo/cli/usage.rb', line 22 def to_s indent(["", .call, "Options:", "", indent(), "\n"].join("\n")) end |