Class: Uniword::Themes::ThemeTransformation
- Inherits:
-
Object
- Object
- Uniword::Themes::ThemeTransformation
- Defined in:
- lib/uniword/themes/theme_transformation.rb
Overview
Transforms between FriendlyTheme and WordTheme models.
This transformation is bidirectional:
-
to_word: Themes::Theme → Drawingml::Theme (for document generation)
-
from_word: Drawingml::Theme → Themes::Theme (for extraction/editing)
Architecture:
-
Stateless transformation (no instance state)
-
Follows Transformation pattern from lutaml-model
-
Separates concerns: models own serialization, this class owns conversion
Constant Summary collapse
- COLOR_KEYS =
Standard color keys in a theme
%i[dk1 lt1 dk2 lt2 accent1 accent2 accent3 accent4 accent5 accent6 hlink fol_hlink].freeze
Instance Method Summary collapse
-
#from_word(word_theme) ⇒ Themes::Theme
Transform Word theme to friendly theme.
-
#to_word(friendly_theme) ⇒ Drawingml::Theme
Transform friendly theme to Word theme.
Instance Method Details
#from_word(word_theme) ⇒ Themes::Theme
Transform Word theme to friendly theme
47 48 49 50 51 52 53 |
# File 'lib/uniword/themes/theme_transformation.rb', line 47 def from_word(word_theme) Theme.new( name: word_theme.name, color_scheme: extract_color_scheme(word_theme), font_scheme: extract_font_scheme(word_theme), ) end |
#to_word(friendly_theme) ⇒ Drawingml::Theme
Transform friendly theme to Word theme
36 37 38 39 40 41 |
# File 'lib/uniword/themes/theme_transformation.rb', line 36 def to_word(friendly_theme) Drawingml::Theme.new( name: friendly_theme.name, theme_elements: build_theme_elements(friendly_theme), ) end |