class Samovar::Output::Row
Represents a row in usage output.
Rows display formatted option or argument information with proper column alignment.
Attributes
The source object for this row.
@attribute [Object]
Public Class Methods
Source
# File vendor/bundle/ruby/3.4.0/gems/samovar-2.4.1/lib/samovar/output/row.rb, line 15 def initialize(object) @object = object super object.to_a.collect(&:to_s) end
Initialize a new row.
@parameter object [Object] The object to convert to a row (must respond to ‘to_a`).
Calls superclass method
Public Instance Methods
Source
# File vendor/bundle/ruby/3.4.0/gems/samovar-2.4.1/lib/samovar/output/row.rb, line 29 def align(columns) self.collect.with_index do |value, index| value.ljust(columns.widths[index]) end.join(" ") end
Generate an aligned row string.
@parameter columns [Columns] The columns for alignment. @returns [String] The aligned row string.