Class: Uniword::Styles::TableStyleDefinition
- Inherits:
-
StyleDefinition
- Object
- StyleDefinition
- Uniword::Styles::TableStyleDefinition
- Defined in:
- lib/uniword/wordprocessingml/styles/table_style_definition.rb
Overview
Table style definition
Responsibility: Hold table-specific style properties Single Responsibility: Table style configuration only
Defines formatting properties for tables including borders, cell spacing, cell padding, and conditional formatting.
Instance Attribute Summary collapse
-
#cell_properties ⇒ Object
readonly
Returns the value of attribute cell_properties.
-
#conditional_formatting ⇒ Object
readonly
Returns the value of attribute conditional_formatting.
-
#table_properties ⇒ Object
readonly
Returns the value of attribute table_properties.
Attributes inherited from StyleDefinition
Instance Method Summary collapse
-
#full_properties ⇒ Hash
Get all properties.
-
#initialize(config) ⇒ TableStyleDefinition
constructor
A new instance of TableStyleDefinition.
-
#resolve_inheritance(library = nil) ⇒ Hash
Resolve inherited properties for tables.
Methods inherited from StyleDefinition
Constructor Details
#initialize(config) ⇒ TableStyleDefinition
Returns a new instance of TableStyleDefinition.
15 16 17 18 19 20 |
# File 'lib/uniword/wordprocessingml/styles/table_style_definition.rb', line 15 def initialize(config) super @table_properties = config[:table_properties] || {} @cell_properties = config[:cell_properties] || {} @conditional_formatting = config[:conditional_formatting] || {} end |
Instance Attribute Details
#cell_properties ⇒ Object (readonly)
Returns the value of attribute cell_properties.
13 14 15 |
# File 'lib/uniword/wordprocessingml/styles/table_style_definition.rb', line 13 def cell_properties @cell_properties end |
#conditional_formatting ⇒ Object (readonly)
Returns the value of attribute conditional_formatting.
13 14 15 |
# File 'lib/uniword/wordprocessingml/styles/table_style_definition.rb', line 13 def conditional_formatting @conditional_formatting end |
#table_properties ⇒ Object (readonly)
Returns the value of attribute table_properties.
13 14 15 |
# File 'lib/uniword/wordprocessingml/styles/table_style_definition.rb', line 13 def table_properties @table_properties end |
Instance Method Details
#full_properties ⇒ Hash
Get all properties
47 48 49 50 51 52 53 |
# File 'lib/uniword/wordprocessingml/styles/table_style_definition.rb', line 47 def full_properties { table_properties: @table_properties, cell_properties: @cell_properties, conditional_formatting: @conditional_formatting, } end |
#resolve_inheritance(library = nil) ⇒ Hash
Resolve inherited properties for tables
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/uniword/wordprocessingml/styles/table_style_definition.rb', line 26 def resolve_inheritance(library = nil) return full_properties unless @base_style && library base_def = library.table_style(@base_style) base_props = base_def.resolve_inheritance(library) { table_properties: merge_properties(base_props[:table_properties], @table_properties), cell_properties: merge_properties(base_props[:cell_properties], @cell_properties), conditional_formatting: merge_properties( base_props[:conditional_formatting], @conditional_formatting, ), } end |