Sha256: f4fe1216f32c8f6e97bfef96c5e0dfaf837cbf49051128c583c3eb37b0f89879

Contents?: true

Size: 1 KB

Versions: 4

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

module Axlsx
  # The Fill is a formatting object that manages the background color, and pattern for cells.
  # @note The recommended way to manage styles in your workbook is to use Styles#add_style.
  # @see Styles#add_style
  # @see PatternFill
  # @see GradientFill
  class Fill
    # The type of fill
    # @return [PatternFill, GradientFill]
    attr_reader :fill_type

    # Creates a new Fill object
    # @param [PatternFill, GradientFill] fill_type
    # @raise [ArgumentError] if the fill_type parameter is not a PatternFill or a GradientFill instance
    def initialize(fill_type)
      self.fill_type = fill_type
    end

    # Serializes the object
    # @param [String] str
    # @return [String]
    def to_xml_string(str = +'')
      str << '<fill>'
      @fill_type.to_xml_string(str)
      str << '</fill>'
    end

    # @see fill_type
    def fill_type=(v)
      DataTypeValidator.validate "Fill.fill_type", [PatternFill, GradientFill], v
      @fill_type = v
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/caxlsx-4.1.0/lib/axlsx/stylesheet/fill.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/caxlsx-4.1.0/lib/axlsx/stylesheet/fill.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/caxlsx-4.1.0/lib/axlsx/stylesheet/fill.rb
caxlsx-4.1.0 lib/axlsx/stylesheet/fill.rb