Class: Samovar::Output::Header

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#nameObject (readonly)

The command name.



24
25
26
# File 'lib/samovar/output/header.rb', line 24

def name
  @name
end

#objectObject

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