Class: Proforma::Modeling::Table::Cell
Overview
The lowest unit of a table. Each row is comprised of zero or more cells.
Constant Summary
Proforma::Modeling::Types::Align::CENTER, Proforma::Modeling::Types::Align::LEFT, Proforma::Modeling::Types::Align::RIGHT
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(align: LEFT, text: '', width: nil) ⇒ Cell
Returns a new instance of Cell.
21
22
23
24
25
|
# File 'lib/proforma/modeling/table/cell.rb', line 21
def initialize(align: LEFT, text: '', width: nil)
@align = align
@text = text
@width = width
end
|
Instance Attribute Details
#align ⇒ Object
27
28
29
|
# File 'lib/proforma/modeling/table/cell.rb', line 27
def align
@align || LEFT
end
|
#text ⇒ Object
31
32
33
|
# File 'lib/proforma/modeling/table/cell.rb', line 31
def text
@text.to_s
end
|
#width ⇒ Object
35
36
37
|
# File 'lib/proforma/modeling/table/cell.rb', line 35
def width
@width ? @width.to_f : nil
end
|
Instance Method Details
#compile(data, evaluator) ⇒ Object
39
40
41
42
43
44
45
|
# File 'lib/proforma/modeling/table/cell.rb', line 39
def compile(data, evaluator)
self.class.new(
align: align,
text: evaluator.text(data, text),
width: width
)
end
|