Module: Uniword::Wordprocessingml::RunProperties::YamlTransforms

Included in:
Uniword::Wordprocessingml::RunProperties
Defined in:
lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb

Overview

YAML serialization transforms for RunProperties.

Handles bidirectional conversion between flat YAML keys (bold, italic, size, etc.) and the wrapper objects used internally by the OOXML model.

Instance Method Summary collapse

Instance Method Details

#yaml_bold_from(instance, value) ⇒ Object

— Boolean transforms —



14
15
16
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 14

def yaml_bold_from(instance, value)
  instance.bold = Properties::Bold.new(value: value) unless value.nil?
end

#yaml_bold_to(_instance, _doc) ⇒ Object



18
19
20
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 18

def yaml_bold_to(_instance, _doc)
  bold&.value
end

#yaml_caps_from(instance, value) ⇒ Object



54
55
56
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 54

def yaml_caps_from(instance, value)
  instance.caps = Properties::Caps.new(value: value) unless value.nil?
end

#yaml_caps_to(_instance, _doc) ⇒ Object



58
59
60
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 58

def yaml_caps_to(_instance, _doc)
  caps&.value
end

#yaml_character_spacing_from(instance, value) ⇒ Object



80
81
82
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 80

def yaml_character_spacing_from(instance, value)
  instance.character_spacing = Properties::CharacterSpacing.new(value: value.to_i) if value
end

#yaml_character_spacing_to(_instance, _doc) ⇒ Object



84
85
86
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 84

def yaml_character_spacing_to(_instance, _doc)
  character_spacing&.value
end

#yaml_color_from(instance, value) ⇒ Object



98
99
100
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 98

def yaml_color_from(instance, value)
  instance.color = Properties::ColorValue.new(value: value) if value
end

#yaml_color_to(_instance, _doc) ⇒ Object



102
103
104
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 102

def yaml_color_to(_instance, _doc)
  color&.value
end

#yaml_double_strike_from(instance, value) ⇒ Object



38
39
40
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 38

def yaml_double_strike_from(instance, value)
  instance.double_strike = Properties::DoubleStrike.new(value: value) unless value.nil?
end

#yaml_double_strike_to(_instance, _doc) ⇒ Object



42
43
44
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 42

def yaml_double_strike_to(_instance, _doc)
  double_strike&.value
end

#yaml_emboss_from(instance, value) ⇒ Object

— Effect transforms —



163
164
165
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 163

def yaml_emboss_from(instance, value)
  instance.emboss = Properties::Emboss.new(value: value) unless value.nil?
end

#yaml_emboss_to(_instance, _doc) ⇒ Object



167
168
169
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 167

def yaml_emboss_to(_instance, _doc)
  emboss&.value
end

#yaml_font_ascii_from(instance, value) ⇒ Object



125
126
127
128
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 125

def yaml_font_ascii_from(instance, value)
  instance.fonts ||= Properties::RunFonts.new
  instance.fonts.ascii = value if value
end

#yaml_font_ascii_to(_instance, _doc) ⇒ Object



130
131
132
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 130

def yaml_font_ascii_to(_instance, _doc)
  fonts&.ascii
end

#yaml_font_cs_from(instance, value) ⇒ Object



152
153
154
155
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 152

def yaml_font_cs_from(instance, value)
  instance.fonts ||= Properties::RunFonts.new
  instance.fonts.cs = value if value
end

#yaml_font_cs_to(_instance, _doc) ⇒ Object



157
158
159
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 157

def yaml_font_cs_to(_instance, _doc)
  fonts&.cs
end

#yaml_font_east_asia_from(instance, value) ⇒ Object



134
135
136
137
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 134

def yaml_font_east_asia_from(instance, value)
  instance.fonts ||= Properties::RunFonts.new
  instance.fonts.east_asia = value if value
end

#yaml_font_east_asia_to(_instance, _doc) ⇒ Object



139
140
141
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 139

def yaml_font_east_asia_to(_instance, _doc)
  fonts&.east_asia
end

#yaml_font_from(instance, value) ⇒ Object

— Font transforms —



116
117
118
119
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 116

def yaml_font_from(instance, value)
  instance.fonts ||= Properties::RunFonts.new
  instance.fonts.ascii = value if value
end

#yaml_font_h_ansi_from(instance, value) ⇒ Object



143
144
145
146
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 143

def yaml_font_h_ansi_from(instance, value)
  instance.fonts ||= Properties::RunFonts.new
  instance.fonts.h_ansi = value if value
end

#yaml_font_h_ansi_to(_instance, _doc) ⇒ Object



148
149
150
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 148

def yaml_font_h_ansi_to(_instance, _doc)
  fonts&.h_ansi
end

#yaml_font_to(_instance, _doc) ⇒ Object



121
122
123
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 121

def yaml_font_to(_instance, _doc)
  fonts&.ascii
end

#yaml_hidden_from(instance, value) ⇒ Object



62
63
64
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 62

def yaml_hidden_from(instance, value)
  instance.hidden = Properties::Vanish.new(value: value) unless value.nil?
end

#yaml_hidden_to(_instance, _doc) ⇒ Object



66
67
68
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 66

def yaml_hidden_to(_instance, _doc)
  hidden&.value
end

#yaml_highlight_from(instance, value) ⇒ Object



106
107
108
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 106

def yaml_highlight_from(instance, value)
  instance.highlight = Properties::Highlight.new(value: value) if value
end

#yaml_highlight_to(_instance, _doc) ⇒ Object



110
111
112
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 110

def yaml_highlight_to(_instance, _doc)
  highlight&.value
end

#yaml_imprint_from(instance, value) ⇒ Object



171
172
173
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 171

def yaml_imprint_from(instance, value)
  instance.imprint = Properties::Imprint.new(value: value) unless value.nil?
end

#yaml_imprint_to(_instance, _doc) ⇒ Object



175
176
177
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 175

def yaml_imprint_to(_instance, _doc)
  imprint&.value
end

#yaml_italic_from(instance, value) ⇒ Object



22
23
24
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 22

def yaml_italic_from(instance, value)
  instance.italic = Properties::Italic.new(value: value) unless value.nil?
end

#yaml_italic_to(_instance, _doc) ⇒ Object



26
27
28
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 26

def yaml_italic_to(_instance, _doc)
  italic&.value
end

#yaml_outline_from(instance, value) ⇒ Object



187
188
189
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 187

def yaml_outline_from(instance, value)
  instance.outline_level = Properties::OutlineLevel.new(value: value) unless value.nil?
end

#yaml_outline_to(_instance, _doc) ⇒ Object



191
192
193
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 191

def yaml_outline_to(_instance, _doc)
  outline_level.value if outline_level.is_a?(Properties::OutlineLevel)
end

#yaml_shadow_from(instance, value) ⇒ Object



179
180
181
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 179

def yaml_shadow_from(instance, value)
  instance.shadow = Properties::Shadow.new(value: value) unless value.nil?
end

#yaml_shadow_to(_instance, _doc) ⇒ Object



183
184
185
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 183

def yaml_shadow_to(_instance, _doc)
  shadow&.value
end

#yaml_size_from(instance, value) ⇒ Object

— Numeric transforms —



72
73
74
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 72

def yaml_size_from(instance, value)
  instance.size = Properties::FontSize.new(value: value.to_i) if value
end

#yaml_size_to(_instance, _doc) ⇒ Object



76
77
78
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 76

def yaml_size_to(_instance, _doc)
  size&.value
end

#yaml_small_caps_from(instance, value) ⇒ Object



46
47
48
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 46

def yaml_small_caps_from(instance, value)
  instance.small_caps = Properties::SmallCaps.new(value: value) unless value.nil?
end

#yaml_small_caps_to(_instance, _doc) ⇒ Object



50
51
52
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 50

def yaml_small_caps_to(_instance, _doc)
  small_caps&.value
end

#yaml_strike_from(instance, value) ⇒ Object



30
31
32
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 30

def yaml_strike_from(instance, value)
  instance.strike = Properties::Strike.new(value: value) unless value.nil?
end

#yaml_strike_to(_instance, _doc) ⇒ Object



34
35
36
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 34

def yaml_strike_to(_instance, _doc)
  strike&.value
end

#yaml_underline_from(instance, value) ⇒ Object

— String transforms —



90
91
92
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 90

def yaml_underline_from(instance, value)
  instance.underline = Properties::Underline.new(value: value) if value
end

#yaml_underline_to(_instance, _doc) ⇒ Object



94
95
96
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 94

def yaml_underline_to(_instance, _doc)
  underline&.value
end

#yaml_vertical_align_from(instance, value) ⇒ Object



195
196
197
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 195

def yaml_vertical_align_from(instance, value)
  instance.vertical_align = Properties::VerticalAlign.new(value: value) if value
end

#yaml_vertical_align_to(_instance, _doc) ⇒ Object



199
200
201
# File 'lib/uniword/wordprocessingml/run_properties/yaml_transforms.rb', line 199

def yaml_vertical_align_to(_instance, _doc)
  vertical_align&.value
end