Class: Goldendocx::Components::Table
- Inherits:
-
Object
- Object
- Goldendocx::Components::Table
- Includes:
- Element
- Defined in:
- lib/goldendocx/components/table.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Instance Method Summary collapse
- #add_header(title, width: nil) ⇒ Object
- #add_row(cells) ⇒ Object
- #style=(style) ⇒ Object
- #width=(width) ⇒ Object
Methods included from Element
#build_element, #initialize, #namespace, #tag, #tag_name, #to_element, #to_xml
Methods included from HasChildren
#children, #read_child, #read_children
Methods included from HasAttributes
#assign_attributes, #attributes, #read_attributes
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
12 13 14 |
# File 'lib/goldendocx/components/table.rb', line 12 def headers @headers end |
Instance Method Details
#add_header(title, width: nil) ⇒ Object
31 32 33 34 35 |
# File 'lib/goldendocx/components/table.rb', line 31 def add_header(title, width: nil) header.build_cell(content: title, width:) grid_property.build_grid_column(width:) if width header end |
#add_row(cells) ⇒ Object
37 38 39 40 41 |
# File 'lib/goldendocx/components/table.rb', line 37 def add_row(cells) row = build_row cells.each { |data| row.add_cell data } row end |
#style=(style) ⇒ Object
27 28 29 |
# File 'lib/goldendocx/components/table.rb', line 27 def style=(style) property.table_style.style_id = style if style end |
#width=(width) ⇒ Object
23 24 25 |
# File 'lib/goldendocx/components/table.rb', line 23 def width=(width) property.table_width.width = width if width end |