Sha256: c3bb8a2816ce786e55d4c9deb56ba18070a42f28aa4f202466ec74f230202f5b
Contents?: true
Size: 1.32 KB
Versions: 4
Compression:
Stored size: 1.32 KB
Contents
# frozen_string_literal: true require_relative 'columns/column' module OoxmlParser # Class for data of Columns class Columns < OOXMLDocumentObject attr_accessor :count attr_accessor :equal_width alias equal_width? equal_width attr_accessor :column_array # @return [Boolean] Draw Line Between Columns attr_reader :separator # @return [OoxmlSize] space between columns attr_accessor :space def initialize(columns_count = 0) @count = columns_count @column_array = [] end # @return [Array, Column] accessor def [](key) @column_array[key] end # Parse Columns data # @param [Nokogiri::XML:Element] node with Columns data # @return [Columns] value of Columns data def parse(node) node.attributes.each do |key, value| case key when 'num' @count = value.value.to_i when 'sep' @separator = option_enabled?(node, 'sep') when 'equalWidth' @equal_width = option_enabled?(node, 'equalWidth') when 'space' @space = OoxmlSize.new(value.value.to_f) end end node.xpath('*').each do |column_node| case column_node.name when 'col' @column_array << Column.new(parent: self).parse(column_node) end end self end end end
Version data entries
4 entries across 4 versions & 1 rubygems