Module: Archimate::FileFormats::Serializer::ModelExchangeFile::Style
- Included in:
- ModelExchangeFileWriter21, ModelExchangeFileWriter30
- Defined in:
- lib/archimate/file_formats/serializer/model_exchange_file/style.rb
Instance Method Summary collapse
- #serialize_color(xml, color, sym) ⇒ Object
- #serialize_font(xml, style) ⇒ Object
- #serialize_style(xml, style) ⇒ Object
Instance Method Details
#serialize_color(xml, color, sym) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/archimate/file_formats/serializer/model_exchange_file/style.rb', line 33 def serialize_color(xml, color, sym) return if color.nil? h = { r: color.r, g: color.g, b: color.b, a: color.a } h.delete(:a) if color.a.nil? || color.a == 100 xml.send(sym, h) end |
#serialize_font(xml, style) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/archimate/file_formats/serializer/model_exchange_file/style.rb', line 22 def serialize_font(xml, style) return unless style && (style.font || style.font_color) xml.font( remove_nil_values( name: style.font&.name, size: style.font&.size&.round, style: font_style_string(style.font) ) ) { serialize_color(xml, style&.font_color, :color) } end |
#serialize_style(xml, style) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/archimate/file_formats/serializer/model_exchange_file/style.rb', line 8 def serialize_style(xml, style) return unless style xml.style( remove_nil_values( lineWidth: style.line_width ) ) do serialize_color(xml, style.fill_color, :fillColor) serialize_color(xml, style.line_color, :lineColor) serialize_font(xml, style) # TODO: complete this end end |