Class: Docxi::Word::Contents::Table::TableRow
- Inherits:
-
Object
- Object
- Docxi::Word::Contents::Table::TableRow
- Defined in:
- lib/docxi/word/contents/table.rb
Defined Under Namespace
Classes: TableCell
Instance Attribute Summary collapse
-
#cells ⇒ Object
Returns the value of attribute cells.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ TableRow
constructor
A new instance of TableRow.
- #render(xml) ⇒ Object
- #tc(options = {}, &block) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ TableRow
Returns a new instance of TableRow.
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/docxi/word/contents/table.rb', line 71 def initialize(={}) @options = @cells = [] if block_given? yield self else end end |
Instance Attribute Details
#cells ⇒ Object
Returns the value of attribute cells.
70 71 72 |
# File 'lib/docxi/word/contents/table.rb', line 70 def cells @cells end |
#options ⇒ Object
Returns the value of attribute options.
70 71 72 |
# File 'lib/docxi/word/contents/table.rb', line 70 def @options end |
Instance Method Details
#render(xml) ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/docxi/word/contents/table.rb', line 93 def render(xml) xml['w'].tr do if [:height].present? xml['w'].trPr do xml['w'].trHeight('w:val' => [:height], 'w:hRule' => 'atLeast') xml['w'].cantSplit('w:val' => 'false') end end @cells.each do |cell| cell.render(xml) end end end |
#tc(options = {}, &block) ⇒ Object
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/docxi/word/contents/table.rb', line 82 def tc(={}, &block) if @options[:columns_width] width = @options[:columns_width][@cells.size] [:width] ||= width if width end = @options.merge() cell = TableCell.new(, &block) @cells << cell cell end |