Sha256: eb5c5e9f78bac89a5f26eeea76f14ef600ff31b97be66b00430226f26e0d92b9

Contents?: true

Size: 1.42 KB

Versions: 10

Compression:

Stored size: 1.42 KB

Contents

require 'berkeley_library/util/ods/xml/element_node'
require 'berkeley_library/util/ods/xml/table/repeatable'

module BerkeleyLibrary
  module Util
    module ODS
      module XML
        module Table
          class TableColumn < Repeatable

            attr_reader :column_style
            attr_reader :default_cell_style

            # Initializes a new column
            #
            # @param column_style [XML::Style::ColumnStyle] the column style
            # @param default_cell_style [XML::Style::CellStyle] the default cell style for this column
            def initialize(column_style, default_cell_style, number_repeated = 1, table:)
              super('table-column', 'number-columns-repeated', number_repeated, table: table)
              @column_style = column_style
              @default_cell_style = default_cell_style

              set_default_attributes!
            end

            # rubocop:disable Naming/PredicateName
            def has_styles?(column_style, default_cell_style)
              self.column_style == column_style && self.default_cell_style == default_cell_style
            end
            # rubocop:enable Naming/PredicateName

            private

            def set_default_attributes!
              set_attribute('style-name', column_style.style_name)
              set_attribute('default-cell-style-name', default_cell_style.style_name)
            end
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
berkeley_library-tind-0.7.2 lib/berkeley_library/util/ods/xml/table/table_column.rb
berkeley_library-tind-0.7.1 lib/berkeley_library/util/ods/xml/table/table_column.rb
berkeley_library-tind-0.7.0 lib/berkeley_library/util/ods/xml/table/table_column.rb
berkeley_library-tind-0.6.0 lib/berkeley_library/util/ods/xml/table/table_column.rb
berkeley_library-tind-0.5.1 lib/berkeley_library/util/ods/xml/table/table_column.rb
berkeley_library-tind-0.5.0 lib/berkeley_library/util/ods/xml/table/table_column.rb
berkeley_library-tind-0.4.3 lib/berkeley_library/util/ods/xml/table/table_column.rb
berkeley_library-tind-0.4.2 lib/berkeley_library/util/ods/xml/table/table_column.rb
berkeley_library-tind-0.4.1 lib/berkeley_library/util/ods/xml/table/table_column.rb
berkeley_library-tind-0.4.0 lib/berkeley_library/util/ods/xml/table/table_column.rb