Sha256: a478ca32d67ab13e9331ff705d01961529238c9645a15faee16cdd502a64e6ee

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

# -*- coding: 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_accessor :color

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

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

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

    # Serializes the gradientStop
    # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
    # @return [String]
    def to_xml(xml) xml.stop(:position => self.position) {self.color.to_xml(xml)} end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
axlsx-1.0.8 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.0.7 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.0.6 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.0.5 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.0.4 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.0.3 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.0.1 lib/axlsx/stylesheet/gradient_stop.rb
axlsx-1.0.0 lib/axlsx/stylesheet/gradient_stop.rb