Class: Uniword::Themes::Theme
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Uniword::Themes::Theme
- Defined in:
- lib/uniword/themes/theme.rb
Overview
Friendly Theme Model - implementation-independent, human-editable
This model provides a simplified, human-friendly YAML schema for themes. It is intentionally independent of OOXML structure, making it easy to author and edit by hand.
For Word document generation, convert to Drawingml::Theme using ThemeTransformation.to_word_theme(friendly_theme).
Class Method Summary collapse
-
.available_themes ⇒ Array<String>
List all available bundled themes.
-
.load(name) ⇒ Theme
Load a bundled theme by name.
Instance Method Summary collapse
-
#to_word_theme ⇒ Drawingml::Theme
Convert to Word Theme for document generation.
Class Method Details
.available_themes ⇒ Array<String>
List all available bundled themes
150 151 152 153 154 155 156 157 |
# File 'lib/uniword/themes/theme.rb', line 150 def self.available_themes theme_dir = File.join(__dir__, "../../../data/themes") return [] unless Dir.exist?(theme_dir) Dir.glob(File.join(theme_dir, "*.yml")) .map { |p| File.basename(p, ".yml") } .sort end |
.load(name) ⇒ Theme
Load a bundled theme by name
137 138 139 140 141 142 143 144 145 |
# File 'lib/uniword/themes/theme.rb', line 137 def self.load(name) path = File.join(__dir__, "../../../data/themes", "#{name}.yml") unless File.exist?(path) raise ArgumentError, "Theme '#{name}' not found. Available: #{available_themes.join(', ')}" end from_yaml(File.read(path)) end |
Instance Method Details
#to_word_theme ⇒ Drawingml::Theme
Convert to Word Theme for document generation
162 163 164 |
# File 'lib/uniword/themes/theme.rb', line 162 def to_word_theme ThemeTransformation.new.to_word(self) end |