lib/rocx/properties/shading.rb in rocx-0.5.7 vs lib/rocx/properties/shading.rb in rocx-0.5.8
- old
+ new
@@ -1,10 +1,12 @@
module Rocx
module Properties
- class Shading
+ class Shading < ComplexProperty
include AttributeBuilder
+ tag :shd
+
VALID_SHADING_PATTERNS = %i(clear
diagCross
diagStripe
horzCross
horzStripe
@@ -41,29 +43,16 @@
thinVertStripe
vertStripe)
attribute :color, expects: :hex_color
attribute :fill, expects: :hex_color
- attribute :theme_color, expects: :valid_theme_color, displays_as: :themeColor
- attribute :theme_fill, expects: :valid_theme_color, displays_as: :themeFill
- attribute :theme_fill_shade, expects: :hex_digit, displays_as: :themeFillShade
- attribute :theme_fill_tint, expects: :hex_digit, displays_as: :themeFillTint
- attribute :theme_shade, expects: :hex_digit, displays_as: :themeShade
- attribute :theme_tint, expects: :hex_digit, displays_as: :themeTint
+ attribute :theme_color, expects: :valid_theme_color
+ attribute :theme_fill, expects: :valid_theme_color
+ attribute :theme_fill_shade, expects: :hex_digit
+ attribute :theme_fill_tint, expects: :hex_digit
+ attribute :theme_shade, expects: :hex_digit
+ attribute :theme_tint, expects: :hex_digit
attribute :pattern, expects: :shading_pattern, displays_as: :val
-
- def name
- "shading"
- end
-
- def tag
- :shd
- end
-
- def to_xml(xml)
- return if xml_attributes.empty?
- xml["w"].public_send(tag, xml_attributes)
- end
private
def shading_pattern(value)
valid_in? value, VALID_SHADING_PATTERNS