Class: Proforma::Modeling::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/proforma/modeling/table.rb,
lib/proforma/modeling/table/row.rb,
lib/proforma/modeling/table/cell.rb,
lib/proforma/modeling/table/section.rb

Overview

A basic table structure modeled off of an HTML table: A table has three sections: header, body, footer. Each section has rows. Each row has cells.

Defined Under Namespace

Classes: Cell, Row, Section

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body: Section.new, footer: Section.new, header: Section.new) ⇒ Table

Returns a new instance of Table.



25
26
27
28
29
# File 'lib/proforma/modeling/table.rb', line 25

def initialize(body: Section.new, footer: Section.new, header: Section.new)
  @body   = Section.make(body)
  @footer = Section.make(footer)
  @header = Section.make(header)
end

Instance Attribute Details

#bodyObject



31
32
33
# File 'lib/proforma/modeling/table.rb', line 31

def body
  @body || Section.new
end


35
36
37
# File 'lib/proforma/modeling/table.rb', line 35

def footer
  @footer || Section.new
end

#headerObject



39
40
41
# File 'lib/proforma/modeling/table.rb', line 39

def header
  @header || Section.new
end

Instance Method Details

#compile(data, evaluator) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/proforma/modeling/table.rb', line 43

def compile(data, evaluator)
  self.class.new(
    body: body.compile(data, evaluator),
    footer: footer.compile(data, evaluator),
    header: header.compile(data, evaluator)
  )
end