Sha256: e1453704edce675c7bdb5517624b99d29564f24b70506d5cc7e59a26204bb626

Contents?: true

Size: 1.82 KB

Versions: 6

Compression:

Stored size: 1.82 KB

Contents

module Axlsx
  # A border part. 
  class BorderPr
    
    # @return [Color] The color of this border part.
    attr_accessor :color

    # @return [Symbol] The syle of this border part. 
    # @note 
    #  The following are allowed
    #   :none 
    #   :thin
    #   :medium
    #   :dashed
    #   :dotted
    #   :thick
    #   :double
    #   :hair 
    #   :mediumDashed
    #   :dashDot
    #   :mediumDashDot
    #   :dashDotDot
    #   :mediumDashDotDot
    #   :slantDashDot
    attr_accessor :style

    # @return [Symbol] The name of this border part
    # @note 
    #  The following are allowed
    #   :start
    #   :end
    #   :left
    #   :right
    #   :top
    #   :bottom
    #   :diagonal
    #   :vertical
    #   :horizontal
    attr_accessor :name
    
    # Creates a new Border Part Object
    # @option options [Color] color
    # @option options [Symbol] name
    # @option options [Symbol] style
    # @see Axlsx::Border
    def initialize(options={})
      options.each do |o|
        self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
      end
    end

    def name=(v) RestrictionValidator.validate "BorderPr.name", [:start, :end, :left, :right, :top, :bottom, :diagonal, :vertical, :horizontal], v; @name = v end
    def color=(v) DataTypeValidator.validate(:color, Color, v); @color = v end    
    def style=(v) RestrictionValidator.validate "BorderPr.style", [:none, :thin, :medium, :dashed, :dotted, :thick, :double, :hair, :mediumDashed, :dashDot, :mediumDashDot, :dashDotDot, :mediumDashDotDot, :slantDashDot], v; @style = v end

    # Serializes the border part
    # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
    def to_xml(xml)
      xml.send(@name, :style=>@style) {
        @color.to_xml(xml) if @color.is_a? Color
      } 
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
axlsx-1.0.7 lib/axlsx/stylesheet/border_pr.rb~
axlsx-1.0.6 lib/axlsx/stylesheet/border_pr.rb~
axlsx-1.0.5 lib/axlsx/stylesheet/border_pr.rb~
axlsx-1.0.4 lib/axlsx/stylesheet/border_pr.rb~
axlsx-1.0.3 lib/axlsx/stylesheet/border_pr.rb~
axlsx-1.0.1 lib/axlsx/stylesheet/border_pr.rb~