Class: Uniword::Builder::TableBuilder
- Inherits:
-
BaseBuilder
- Object
- BaseBuilder
- Uniword::Builder::TableBuilder
- Includes:
- HasBorders, HasShading
- Defined in:
- lib/uniword/builder/table_builder.rb
Overview
Builds and configures Table objects.
Instance Attribute Summary
Attributes inherited from BaseBuilder
Class Method Summary collapse
Instance Method Summary collapse
- #align=(value) ⇒ Object
-
#indent(value) ⇒ self
Set table indentation.
-
#row {|TableRowBuilder| ... } ⇒ TableRowBuilder
Create and add a row to the table.
-
#width(value, rule: nil) ⇒ self
Set table width.
Methods included from HasShading
Methods included from HasBorders
Methods inherited from BaseBuilder
#build, from_model, #initialize
Constructor Details
This class inherits a constructor from Uniword::Builder::BaseBuilder
Class Method Details
.default_model_class ⇒ Object
18 19 20 |
# File 'lib/uniword/builder/table_builder.rb', line 18 def self.default_model_class Wordprocessingml::Table end |
Instance Method Details
#align=(value) ⇒ Object
57 58 59 60 61 |
# File 'lib/uniword/builder/table_builder.rb', line 57 def align=(value) ensure_properties @model.properties.justification = Properties::TableJustification.new(value: value.to_s) self end |
#indent(value) ⇒ self
Set table indentation
50 51 52 53 54 55 |
# File 'lib/uniword/builder/table_builder.rb', line 50 def indent(value) ensure_properties @model.properties.table_indent ||= Properties::TableIndent.new @model.properties.table_indent.value = value self end |
#row {|TableRowBuilder| ... } ⇒ TableRowBuilder
Create and add a row to the table
26 27 28 29 30 31 |
# File 'lib/uniword/builder/table_builder.rb', line 26 def row(&block) r = TableRowBuilder.new yield(r) if block @model.rows << r.build r end |
#width(value, rule: nil) ⇒ self
Set table width
38 39 40 41 42 43 44 |
# File 'lib/uniword/builder/table_builder.rb', line 38 def width(value, rule: nil) ensure_properties @model.properties.table_width ||= Properties::TableWidth.new @model.properties.table_width.value = value @model.properties.table_width.rule = rule if rule self end |