Class: Uniword::Styles::ParagraphStyleDefinition
- Inherits:
-
StyleDefinition
- Object
- StyleDefinition
- Uniword::Styles::ParagraphStyleDefinition
- Defined in:
- lib/uniword/wordprocessingml/styles/paragraph_style_definition.rb
Overview
Paragraph style definition
Responsibility: Hold paragraph-specific style properties Single Responsibility: Paragraph style configuration only
Defines formatting properties for paragraphs including alignment, spacing, indentation, and default run properties.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#next_style ⇒ Object
readonly
Returns the value of attribute next_style.
-
#run_properties ⇒ Object
readonly
Returns the value of attribute run_properties.
Attributes inherited from StyleDefinition
Instance Method Summary collapse
-
#full_properties ⇒ Hash
Get all properties including run properties.
-
#initialize(config) ⇒ ParagraphStyleDefinition
constructor
A new instance of ParagraphStyleDefinition.
-
#resolve_inheritance(library = nil) ⇒ Hash
Resolve inherited properties including run properties.
Methods inherited from StyleDefinition
Constructor Details
#initialize(config) ⇒ ParagraphStyleDefinition
Returns a new instance of ParagraphStyleDefinition.
15 16 17 18 19 |
# File 'lib/uniword/wordprocessingml/styles/paragraph_style_definition.rb', line 15 def initialize(config) super @next_style = config[:next_style] @run_properties = config[:run_properties] || {} end |
Instance Attribute Details
#next_style ⇒ Object (readonly)
Returns the value of attribute next_style.
13 14 15 |
# File 'lib/uniword/wordprocessingml/styles/paragraph_style_definition.rb', line 13 def next_style @next_style end |
#run_properties ⇒ Object (readonly)
Returns the value of attribute run_properties.
13 14 15 |
# File 'lib/uniword/wordprocessingml/styles/paragraph_style_definition.rb', line 13 def run_properties @run_properties end |
Instance Method Details
#full_properties ⇒ Hash
Get all properties including run properties
41 42 43 44 45 46 |
# File 'lib/uniword/wordprocessingml/styles/paragraph_style_definition.rb', line 41 def full_properties { properties: properties, run_properties: @run_properties, } end |
#resolve_inheritance(library = nil) ⇒ Hash
Resolve inherited properties including run properties
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/uniword/wordprocessingml/styles/paragraph_style_definition.rb', line 25 def resolve_inheritance(library = nil) return full_properties unless @base_style && library base_def = library.paragraph_style(@base_style) base_props = base_def.resolve_inheritance(library) { properties: merge_properties(base_props[:properties], properties), run_properties: merge_properties(base_props[:run_properties], @run_properties), } end |