class Proforma::Modeling::DataTable::Column

An explicit table column that understands how to compile header, body, and footer cells from records.

Attributes

align[W]
body[W]
header[W]
width[W]

Public Class Methods

new( align: LEFT, body: '', footer: '', header: '', width: nil ) click to toggle source
# File lib/proforma/modeling/data_table/column.rb, line 26
def initialize(
  align: LEFT,
  body: '',
  footer: '',
  header: '',
  width: nil
)
  @align  = align
  @body   = body
  @footer = footer
  @header = header
  @width  = width
end

Public Instance Methods

align() click to toggle source
# File lib/proforma/modeling/data_table/column.rb, line 40
def align
  @align || LEFT
end
body() click to toggle source
# File lib/proforma/modeling/data_table/column.rb, line 44
def body
  @body.to_s
end
compile_body_cell(record, evaluator) click to toggle source
# File lib/proforma/modeling/data_table/column.rb, line 68
def compile_body_cell(record, evaluator)
  Modeling::Table::Cell.new(
    align: align,
    text: evaluator.text(record, body),
    width: width
  )
end
compile_header_cell(record, evaluator) click to toggle source
# File lib/proforma/modeling/data_table/column.rb, line 60
def compile_header_cell(record, evaluator)
  Modeling::Table::Cell.new(
    align: align,
    text: evaluator.text(record, header),
    width: width
  )
end
header() click to toggle source
# File lib/proforma/modeling/data_table/column.rb, line 52
def header
  @header.to_s
end
header?() click to toggle source
# File lib/proforma/modeling/data_table/column.rb, line 88
def header?
  !header.to_s.empty?
end
width() click to toggle source
# File lib/proforma/modeling/data_table/column.rb, line 56
def width
  @width ? @width.to_f : nil
end