Class: Axlsx::GradientFill
- Inherits:
-
Object
- Object
- Axlsx::GradientFill
- Includes:
- OptionsParser, SerializedAttributes
- Defined in:
- lib/axlsx/stylesheet/gradient_fill.rb
Overview
A GradientFill defines the color and positioning for gradiant cell fill.
Instance Attribute Summary collapse
-
#bottom ⇒ Float
Percentage format bottom.
-
#degree ⇒ Float
Angle of the linear gradient.
-
#left ⇒ Float
Percentage format left.
-
#right ⇒ Float
Percentage format right.
-
#stop ⇒ SimpleTypedList
readonly
Collection of stop objects.
-
#top ⇒ Float
Percentage format top.
-
#type ⇒ Symbol
The type of gradient.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ GradientFill
constructor
Creates a new GradientFill object.
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
-
#validate_format_percentage(name, value) ⇒ Object
validates that the value provided is between 0.0 and 1.0.
Methods included from SerializedAttributes
#declared_attributes, included, #serialized_attributes, #serialized_element_attributes, #serialized_tag
Methods included from OptionsParser
Constructor Details
#initialize(options = {}) ⇒ GradientFill
Creates a new GradientFill object
15 16 17 18 19 |
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 15 def initialize( = {}) [:type] ||= :linear @stop = SimpleTypedList.new GradientStop end |
Instance Attribute Details
#bottom ⇒ Float
Percentage format bottom
49 50 51 |
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 49 def bottom @bottom end |
#degree ⇒ Float
Angle of the linear gradient
33 34 35 |
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 33 def degree @degree end |
#left ⇒ Float
Percentage format left
37 38 39 |
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 37 def left @left end |
#right ⇒ Float
Percentage format right
41 42 43 |
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 41 def right @right end |
#stop ⇒ SimpleTypedList (readonly)
Collection of stop objects
53 54 55 |
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 53 def stop @stop end |
#top ⇒ Float
Percentage format top
45 46 47 |
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 45 def top @top end |
#type ⇒ Symbol
valid options are :linear :path
The type of gradient.
29 30 31 |
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 29 def type @type end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the object
93 94 95 96 97 98 99 |
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 93 def to_xml_string(str = '') str << '<gradientFill ' serialized_attributes str str << '>' @stop.each { |s| s.to_xml_string(str) } str << '</gradientFill>' end |
#validate_format_percentage(name, value) ⇒ Object
validates that the value provided is between 0.0 and 1.0
86 87 88 |
# File 'lib/axlsx/stylesheet/gradient_fill.rb', line 86 def validate_format_percentage(name, value) DataTypeValidator.validate name, Float, value, lambda { |arg| arg >= 0.0 && arg <= 1.0 } end |