class Terminal::Table::Style
A Style object holds all the formatting information for a Table object
To create a table with a certain style, use either the constructor option
:style
, the Terminal::Table#style object or the
Terminal::Table#style= method
All these examples have the same effect:
# by constructor @table = Table.new(:style => {:padding_left => 2, :width => 40}) # by object @table.style.padding_left = 2 @table.style.width = 40 # by method @table.style = {:padding_left => 2, :width => 40}
To set a default style for all tables created afterwards use ::defaults=
Terminal::Table::Style.defaults = {:width => 80}
Attributes
border_i[RW]
border_x[RW]
border_y[RW]
padding_left[RW]
padding_right[RW]
width[RW]
Public Class Methods
defaults()
click to toggle source
# File lib/terminal-table/style.rb, line 51 def defaults @@defaults end
defaults=(options)
click to toggle source
# File lib/terminal-table/style.rb, line 55 def defaults= options @@defaults = defaults.merge(options) end
new(options = {})
click to toggle source
# File lib/terminal-table/style.rb, line 42 def initialize options = {} apply self.class.defaults.merge(options) end
Public Instance Methods
apply(options)
click to toggle source
# File lib/terminal-table/style.rb, line 46 def apply options options.each { |m, v| __send__ "#{m}=", v } end