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) ⇒ Object
-
#initialize(model = nil) ⇒ TableBuilder
constructor
A new instance of TableBuilder.
- #row {|r| ... } ⇒ Object
- #width(value, rule: nil) ⇒ Object
Methods included from HasShading
Methods included from HasBorders
Methods inherited from BaseBuilder
Constructor Details
#initialize(model = nil) ⇒ TableBuilder
Returns a new instance of TableBuilder.
22 23 24 25 |
# File 'lib/uniword/builder/table_builder.rb', line 22 def initialize(model = nil) super ensure_table_structure end |
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
50 51 52 53 54 |
# File 'lib/uniword/builder/table_builder.rb', line 50 def align=(value) ensure_properties @model.properties.justification = Properties::TableJustification.new(value: value.to_s) self end |
#indent(value) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/uniword/builder/table_builder.rb', line 43 def indent(value) ensure_properties @model.properties.table_indent ||= Properties::TableIndent.new @model.properties.table_indent.value = value self end |
#row {|r| ... } ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/uniword/builder/table_builder.rb', line 27 def row(&block) r = TableRowBuilder.new yield(r) if block @model.rows << r.build finalize_table_structure r end |
#width(value, rule: nil) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/uniword/builder/table_builder.rb', line 35 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 |