class Terminal::Table::Style
Terminal::Table::Style.defaults = {:width => 80}
To set a default style for all tables created afterwards use Style.defaults=
@table.style = {:padding_left => 2, :width => 40}
# by method
@table.style.width = 40
@table.style.padding_left = 2
# by object
@table = Table.new(:style => {:padding_left => 2, :width => 40})
# by constructor
All these examples have the same effect:
option :style
, the Table#style object or the Table#style= method
To create a table with a certain style, use either the constructor
A Style object holds all the formatting information for a Table object
def apply options
def apply options options.each { |m, v| __send__ "#{m}=", v } end
def defaults
def defaults @@defaults end
def defaults= options
def defaults= options @@defaults = defaults.merge(options) end
def initialize options = {}
def initialize options = {} apply self.class.defaults.merge(options) end