Class: PureDocx::XmlGenerators::Cell

Inherits:
Base
  • Object
show all
Defined in:
lib/puredocx/xml_generators/cell.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#content, #rels_constructor

Instance Method Summary collapse

Methods inherited from Base

#xml

Constructor Details

#initialize(content, rels_constructor, arguments = {}) ⇒ Cell

Returns a new instance of Cell.



6
7
8
9
# File 'lib/puredocx/xml_generators/cell.rb', line 6

def initialize(content, rels_constructor, arguments = {})
  super(content, rels_constructor)
  @width = arguments[:width]
end

Instance Attribute Details

#widthObject (readonly)

Returns the value of attribute width.



4
5
6
# File 'lib/puredocx/xml_generators/cell.rb', line 4

def width
  @width
end

Instance Method Details

#paramsObject



15
16
17
18
19
20
# File 'lib/puredocx/xml_generators/cell.rb', line 15

def params
  {
    '{CONTENT}' => content[:column].map(&:chomp).join,
    '{WIDTH}'   => width
  }
end

#templateObject



11
12
13
# File 'lib/puredocx/xml_generators/cell.rb', line 11

def template
  File.read(DocArchive.template_path('table/cells.xml'))
end