Class: Uniword::ThemeWriter
- Inherits:
-
Object
- Object
- Uniword::ThemeWriter
- Defined in:
- lib/uniword/theme_writer.rb
Overview
Writer for saving Theme instances to files.
Responsibility: Handle theme file writing operations. Follows Single Responsibility Principle - separated from Theme class.
Instance Attribute Summary collapse
-
#theme ⇒ Object
readonly
Returns the value of attribute theme.
Instance Method Summary collapse
-
#initialize(theme) ⇒ ThemeWriter
constructor
Initialize writer with a theme.
-
#save(path, format: :auto) ⇒ void
Save theme to file.
Constructor Details
#initialize(theme) ⇒ ThemeWriter
Initialize writer with a theme.
22 23 24 |
# File 'lib/uniword/theme_writer.rb', line 22 def initialize(theme) @theme = theme end |
Instance Attribute Details
#theme ⇒ Object (readonly)
Returns the value of attribute theme.
17 18 19 |
# File 'lib/uniword/theme_writer.rb', line 17 def theme @theme end |
Instance Method Details
#save(path, format: :auto) ⇒ void
This method returns an undefined value.
Save theme to file.
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/uniword/theme_writer.rb', line 31 def save(path, format: :auto) format = infer_format(path) if format == :auto case format when :thmx Ooxml::ThmxPackage.to_file(theme, path) else raise ArgumentError, "Unsupported format for theme: #{format}" end end |