Class: CLAide::Command::Banner
- Inherits:
-
Object
- Object
- CLAide::Command::Banner
- Defined in:
- lib/claide/command/banner.rb
Overview
Creates the formatted banner to present as help of the provided command class.
Defined Under Namespace
Modules: TextWrapper
Instance Attribute Summary collapse
-
#command ⇒ Class
The command for which the banner should be created.
Instance Method Summary collapse
-
#formatted_banner ⇒ String
The banner for the command.
-
#initialize(command) ⇒ Banner
constructor
A new instance of Banner.
Constructor Details
#initialize(command) ⇒ Banner
Returns a new instance of Banner.
15 16 17 |
# File 'lib/claide/command/banner.rb', line 15 def initialize(command) @command = command end |
Instance Attribute Details
#command ⇒ Class
Returns The command for which the banner should be created.
11 12 13 |
# File 'lib/claide/command/banner.rb', line 11 def command @command end |
Instance Method Details
#formatted_banner ⇒ String
Returns The banner for the command.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/claide/command/banner.rb', line 21 def sections = [ ['Usage', formatted_usage_description], ['Commands', formatted_subcommand_summaries], ['Options', ], ] = sections.map do |(title, body)| [prettify_title("#{title}:"), body] unless body.empty? end.compact.join("\n\n") end |