Module: Uniword::Wordprocessingml::RunProperties::Conversion
- Included in:
- Uniword::Wordprocessingml::RunProperties
- Defined in:
- lib/uniword/wordprocessingml/run_properties/conversion.rb
Overview
Initialization and primitive-to-wrapper conversion for RunProperties.
Handles the bridging between convenience constructors (e.g., RunProperties.new(bold: true)) and the wrapper objects (e.g., Properties::Bold) required by lutaml-model.
Instance Method Summary collapse
-
#convert_primitive_attributes! ⇒ Object
Convert primitive attribute values to proper wrapper objects.
- #initialize(attrs = {}) ⇒ Object
Instance Method Details
#convert_primitive_attributes! ⇒ Object
Convert primitive attribute values to proper wrapper objects. Called after super() to handle cases where primitives were passed instead of the expected Serializable wrapper types.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/uniword/wordprocessingml/run_properties/conversion.rb', line 39 def convert_primitive_attributes! convert_boolean_attrs! convert_style_attr! convert_size_attrs! convert_color_attr! convert_underline_attr! convert_highlight_attr! convert_vertical_align_attr! convert_simple_wrapper_attrs! convert_text_effect_attrs! end |
#initialize(attrs = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/uniword/wordprocessingml/run_properties/conversion.rb', line 12 def initialize(attrs = {}) # Extract flat convenience keys before super (lutaml-model ignores # unknown keys). These are converted to proper wrapper objects below. font_val = attrs.delete(:font) || attrs.delete("font") font_ascii_val = attrs.delete(:font_ascii) || attrs.delete("font_ascii") font_ea_val = attrs.delete(:font_east_asia) || attrs.delete("font_east_asia") font_ha_val = attrs.delete(:font_h_ansi) || attrs.delete("font_h_ansi") font_cs_val = attrs.delete(:font_cs) || attrs.delete("font_cs") lang_val = attrs.delete(:language_val) || attrs.delete("language_val") lang_ea = attrs.delete(:language_east_asia) || attrs.delete("language_east_asia") lang_bidi = attrs.delete(:language_bidi) || attrs.delete("language_bidi") raw_language = extract_raw_language(attrs) shading_fill_val = attrs.delete(:shading_fill) || attrs.delete("shading_fill") shading_type_val = attrs.delete(:shading_type) || attrs.delete("shading_type") super convert_primitive_attributes! apply_font_overrides(font_val, font_ascii_val, font_ea_val, font_ha_val, font_cs_val) apply_language_overrides(lang_val, lang_ea, lang_bidi, raw_language) apply_shading_overrides(shading_fill_val, shading_type_val) end |