Method: Yummi::Table#initialize
- Defined in:
- lib/yummi/table.rb
#initialize(params = {}) ⇒ Table
Creates a new table. A hash containing the style properties may be given to override the defaults.
-
Title (title): none
-
Description (description): none
-
Header (header): none
Hash in “style” key:
-
Title color (title): bold.yellow
-
Header color (header): bold.blue
-
Values color (color): none
-
Colspan (colspan): 2
-
Default Align (align): right and first element to left
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/yummi/table.rb', line 72 def initialize(params = {}) params = OpenStruct::new params params.style ||= {} @data = [] @header = [] @title = (params.title or nil) @description = (params.description or nil) @style = { :title => (params.style[:title] or 'bold.yellow'), :description => (params.style[:description] or 'bold.black'), :header => (params.style[:header] or 'bold.blue'), :value => (params.style[:color] or nil) } @colspan = (params.colspan or 2) @layout = (params.layout or :horizontal) @default_align = (params.align or :right) @aliases = [] @align = [:left] @components = {} @contexts = [:default] _define_ :default @current_context = :default self.header = params.header if params.header end |