Class: Archimate::Svg::CssStyle
- Inherits:
-
Object
- Object
- Archimate::Svg::CssStyle
- Defined in:
- lib/archimate/svg/css_style.rb
Instance Attribute Summary collapse
-
#style ⇒ Object
readonly
Returns the value of attribute style.
Instance Method Summary collapse
-
#initialize(style) ⇒ CssStyle
constructor
A new instance of CssStyle.
- #text ⇒ Object
- #to_css(style_hash) ⇒ Object
Constructor Details
#initialize(style) ⇒ CssStyle
Returns a new instance of CssStyle.
8 9 10 |
# File 'lib/archimate/svg/css_style.rb', line 8 def initialize(style) @style = style end |
Instance Attribute Details
#style ⇒ Object (readonly)
Returns the value of attribute style.
6 7 8 |
# File 'lib/archimate/svg/css_style.rb', line 6 def style @style end |
Instance Method Details
#text ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/archimate/svg/css_style.rb', line 12 def text return "" if style.nil? to_css( "fill": style.font_color&.to_rgba, "color": style.font_color&.to_rgba, "font-family": style.font&.name, "font-size": style.font&.size, "text-align": style.text_align ) end |
#to_css(style_hash) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/archimate/svg/css_style.rb', line 23 def to_css(style_hash) style_hash .delete_if { |_key, value| value.nil? } .map { |key, value| "#{key}:#{value};" } .join("") end |