Class: WizRtf::Cell
- Inherits:
-
Object
- Object
- WizRtf::Cell
- Defined in:
- lib/wiz_rtf/cell.rb
Instance Attribute Summary collapse
-
#colspan ⇒ Object
Returns the value of attribute colspan.
-
#content ⇒ Object
Returns the value of attribute content.
-
#right_width ⇒ Object
Returns the value of attribute right_width.
-
#rowspan ⇒ Object
Returns the value of attribute rowspan.
-
#v_merge ⇒ Object
Returns the value of attribute v_merge.
Instance Method Summary collapse
-
#initialize(cell) ⇒ Cell
constructor
A new instance of Cell.
- #render(io) ⇒ Object
Constructor Details
#initialize(cell) ⇒ Cell
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/wiz_rtf/cell.rb', line 11 def initialize(cell) if cell.is_a?(Hash) @colspan = cell[:colspan] || 1 @rowspan = cell[:rowspan] || 1 @content = cell[:content] || '' else @colspan = 1 @rowspan = 1 @content = cell end end |
Instance Attribute Details
#colspan ⇒ Object
Returns the value of attribute colspan.
9 10 11 |
# File 'lib/wiz_rtf/cell.rb', line 9 def colspan @colspan end |
#content ⇒ Object
Returns the value of attribute content.
9 10 11 |
# File 'lib/wiz_rtf/cell.rb', line 9 def content @content end |
#right_width ⇒ Object
Returns the value of attribute right_width.
9 10 11 |
# File 'lib/wiz_rtf/cell.rb', line 9 def right_width @right_width end |
#rowspan ⇒ Object
Returns the value of attribute rowspan.
9 10 11 |
# File 'lib/wiz_rtf/cell.rb', line 9 def rowspan @rowspan end |
#v_merge ⇒ Object
Returns the value of attribute v_merge.
9 10 11 |
# File 'lib/wiz_rtf/cell.rb', line 9 def v_merge @v_merge end |
Instance Method Details
#render(io) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/wiz_rtf/cell.rb', line 23 def render(io) io.cmd :celld io.cmd :clbrdrt io.cmd :brdrs io.cmd :brdrw10 io.cmd :clbrdrl io.cmd :brdrs io.cmd :brdrw10 io.cmd :clbrdrb io.cmd :brdrs io.cmd :brdrw10 io.cmd :clbrdrr io.cmd :brdrs io.cmd :brdrw10 io.cmd v_merge if v_merge io.cmd :cellx, right_width contents = [@content] unless @content.is_a?(Array) contents.each do |c| if c.respond_to?(:render) c.render(io) else io.txt c end end io.cmd :cell end |