Class: Axlsx::GradientStop

Inherits:
Object
  • Object
show all
Defined in:
lib/axlsx/stylesheet/gradient_stop.rb

Overview

The GradientStop object represents a color point in a gradient.

See Also:

  • Office XML Part 1 ยง18.8.24

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(color, position) ⇒ GradientStop

Creates a new GradientStop object

Parameters:

  • color (Color)
  • position (Float)


19
20
21
22
# File 'lib/axlsx/stylesheet/gradient_stop.rb', line 19

def initialize(color, position)
  self.color = color
  self.position = position
end

Instance Attribute Details

#colorColor

The color for this gradient stop

Returns:

See Also:



10
11
12
# File 'lib/axlsx/stylesheet/gradient_stop.rb', line 10

def color
  @color
end

#positionFloat

The position of the color

Returns:

  • (Float)


14
15
16
# File 'lib/axlsx/stylesheet/gradient_stop.rb', line 14

def position
  @position
end

Instance Method Details

#to_xml_string(str = +'')) ⇒ String

Serializes the object

Parameters:

  • str (String) (defaults to: +''))

Returns:

  • (String)


39
40
41
42
43
# File 'lib/axlsx/stylesheet/gradient_stop.rb', line 39

def to_xml_string(str = +'')
  str << '<stop position="' << position.to_s << '">'
  color.to_xml_string(str)
  str << '</stop>'
end