Class: Samovar::Output::Header
- Inherits:
-
Object
- Object
- Samovar::Output::Header
- Defined in:
- lib/samovar/output/header.rb
Overview
Represents a header row in usage output.
Headers display command names and their descriptions.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
The command name.
-
#object ⇒ Object
The command class.
Instance Method Summary collapse
-
#align(columns) ⇒ Object
Generate an aligned header string.
-
#initialize(name, object) ⇒ Header
constructor
Initialize a new header.
Constructor Details
#initialize(name, object) ⇒ Header
Initialize a new header.
16 17 18 19 |
# File 'lib/samovar/output/header.rb', line 16 def initialize(name, object) @name = name @object = object end |
Instance Attribute Details
#name ⇒ Object (readonly)
The command name.
24 25 26 |
# File 'lib/samovar/output/header.rb', line 24 def name @name end |
#object ⇒ Object
The command class.
29 30 31 |
# File 'lib/samovar/output/header.rb', line 29 def object @object end |
Instance Method Details
#align(columns) ⇒ Object
Generate an aligned header string.
35 36 37 |
# File 'lib/samovar/output/header.rb', line 35 def align(columns) @object.command_line(@name) end |