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.
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/docxi/word/contents/table.rb', line 60 def initialize(={}) @options = @cells = [] if block_given? yield self else end end |
Instance Attribute Details
#cells ⇒ Object
Returns the value of attribute cells.
59 60 61 |
# File 'lib/docxi/word/contents/table.rb', line 59 def cells @cells end |
#options ⇒ Object
Returns the value of attribute options.
59 60 61 |
# File 'lib/docxi/word/contents/table.rb', line 59 def @options end |
Instance Method Details
#render(xml) ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/docxi/word/contents/table.rb', line 82 def render(xml) xml['w'].tr do @cells.each do |cell| cell.render(xml) end end end |
#tc(options = {}, &block) ⇒ Object
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/docxi/word/contents/table.rb', line 71 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 |