class TermUtils::Tab::Header
Represents a column header.
Attributes
align[RW]
@return [Symbol] `:left`, `:right`.
title[RW]
@return [String]
Public Class Methods
new(opts = {})
click to toggle source
Constructs a new Header
. @param opts [Hash] @option opts [String] :title @option opts [Symbol] :align
# File lib/term_utils/tab.rb, line 377 def initialize(opts = {}) @title = opts.fetch(:title) @align = opts.fetch(:align, :left) end
Public Instance Methods
validate()
click to toggle source
Validates the column represented by this one. @return [nil] @raise [TermUtils::Tab::TableError]
# File lib/term_utils/tab.rb, line 385 def validate raise TermUtils::Tab::TableError, 'missing header title (nil)' if @title.nil? raise TermUtils::Tab::TableError, 'wrong header align (not :left or :right)' unless %i[left right].index(@align) end