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
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/archimate/file_formats/serializer/model_exchange_file/style.rb', line 29 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
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/archimate/file_formats/serializer/model_exchange_file/style.rb', line 18 def serialize_font(xml, style) return unless style && (style.font || style.font_color) xml.font( { name: style.font&.name, size: style.font&.size&.round, style: font_style_string(style.font) }.compact ) { serialize_color(xml, style&.font_color, :color) } end |
#serialize_style(xml, style) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/archimate/file_formats/serializer/model_exchange_file/style.rb', line 8 def serialize_style(xml, style) return unless style xml.style({ lineWidth: style.line_width }.compact) do serialize_color(xml, style.fill_color, :fillColor) serialize_color(xml, style.line_color, :lineColor) serialize_font(xml, style) # TODO: complete this end end |