class Row
Represents a row in usage output.
Rows display formatted option or argument information with proper column alignment.
Definitions
def initialize(object)
Initialize a new row.
Signature
-
parameter
object
Object
The object to convert to a row (must respond to
to_a
).
Implementation
def initialize(object)
@object = object
super object.to_a.collect(&:to_s)
end
attr :object
The source object for this row.
Signature
-
attribute
Object
def align(columns)
Generate an aligned row string.
Signature
-
parameter
columns
Columns
The columns for alignment.
-
returns
String
The aligned row string.
Implementation
def align(columns)
self.collect.with_index do |value, index|
value.ljust(columns.widths[index])
end.join(" ")
end