Class: Svg::Style
- Inherits:
-
String
- Object
- String
- Svg::Style
- Defined in:
- lib/svg.rb
Instance Attribute Summary collapse
-
#fill ⇒ Object
Returns the value of attribute fill.
-
#fill_opacity ⇒ Object
Returns the value of attribute fill_opacity.
-
#opacity ⇒ Object
Returns the value of attribute opacity.
-
#stroke ⇒ Object
Returns the value of attribute stroke.
-
#stroke_opacity ⇒ Object
Returns the value of attribute stroke_opacity.
-
#stroke_width ⇒ Object
Returns the value of attribute stroke_width.
Instance Method Summary collapse
Instance Attribute Details
#fill ⇒ Object
Returns the value of attribute fill.
28 29 30 |
# File 'lib/svg.rb', line 28 def fill @fill end |
#fill_opacity ⇒ Object
Returns the value of attribute fill_opacity.
28 29 30 |
# File 'lib/svg.rb', line 28 def fill_opacity @fill_opacity end |
#opacity ⇒ Object
Returns the value of attribute opacity.
28 29 30 |
# File 'lib/svg.rb', line 28 def opacity @opacity end |
#stroke ⇒ Object
Returns the value of attribute stroke.
28 29 30 |
# File 'lib/svg.rb', line 28 def stroke @stroke end |
#stroke_opacity ⇒ Object
Returns the value of attribute stroke_opacity.
28 29 30 |
# File 'lib/svg.rb', line 28 def stroke_opacity @stroke_opacity end |
#stroke_width ⇒ Object
Returns the value of attribute stroke_width.
28 29 30 |
# File 'lib/svg.rb', line 28 def stroke_width @stroke_width end |
Instance Method Details
#attr_to_s(attr_name, attr_val) ⇒ Object
42 43 44 45 |
# File 'lib/svg.rb', line 42 def attr_to_s (attr_name, attr_val) return '' if attr_val.nil? " #{attr_name}:#{attr_val};" if not attr_val.to_s.empty? end |
#to_s ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/svg.rb', line 29 def to_s string_val = attr_to_s 'fill', fill string_val += attr_to_s 'stroke', stroke string_val += attr_to_s 'stroke-width', stroke_width string_val += attr_to_s 'opacity', opacity string_val += attr_to_s 'fill-opacity', fill_opacity string_val += attr_to_s 'stroke-opacity', stroke_opacity if not string_val.empty? string_val.strip! string_val.chop! end return string_val end |