Sha256: 732686dc73b2c4e0d203cc8afec7b4e7da15f1012cb4e416d935e0b8cab7ab08

Contents?: true

Size: 1.03 KB

Versions: 22

Compression:

Stored size: 1.03 KB

Contents

# encoding: UTF-8
module Axlsx
  # The GradientStop object represents a color point in a gradient.
  # @see Open Office XML Part 1 ยง18.8.24
  class GradientStop
    # The color for this gradient stop
    # @return [Color]
    # @see Color
    attr_reader :color

    # The position of the color
    # @return [Float]
    attr_reader :position

    # Creates a new GradientStop object
    # @param [Color] color
    # @param [Float] position
    def initialize(color, position)
      self.color = color
      self.position = position
    end

    # @see color
    def color=(v) DataTypeValidator.validate "GradientStop.color", Color, v; @color=v end
    # @see position
    def position=(v) DataTypeValidator.validate "GradientStop.position", Float, v, lambda { |arg| arg >= 0 && arg <= 1}; @position = v end

    # Serializes the object
    # @param [String] str
    # @return [String]
    def to_xml_string(str = '')
      str << '<stop position="' << position.to_s << '">'
      self.color.to_xml_string(str)
      str << '</stop>'
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
caxlsx-2.0.2 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-2.0.1 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-2.0.0 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.3.6 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.3.5 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.3.4 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.3.3 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.3.2 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.3.1 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.2.3 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.2.2 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.2.1 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.2.0 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.1.8 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.1.7 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.1.6 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.1.5 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.1.4 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.1.3 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.1.2 lib/axlsx/stylesheet/gradient_stop.rb