Sha256: 986d6f6925cd2db8c0a0050cbd9301b5dac43a791806758592d48ab0e521403c

Contents?: true

Size: 723 Bytes

Versions: 2

Compression:

Stored size: 723 Bytes

Contents

# frozen_string_literal: true

module Goldendocx
  module Tables
    class Row
      include Goldendocx::Element

      namespace :w
      tag :tr

      embeds_one :row_property, class_name: 'Goldendocx::Tables::Properties::RowProperty', auto_build: true
      embeds_many :cells, class_name: 'Goldendocx::Tables::Cell'

      def height=(height)
        row_property.height.height = height if height
      end

      def add_cell(data)
        cell = case data
               when Goldendocx::Tables::Cell then data
               when Hash then Goldendocx::Tables::Cell.new(**data)
               else Goldendocx::Tables::Cell.new(content: data.to_s)
               end
        cells << cell
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
goldendocx-0.3.0 lib/goldendocx/tables/row.rb
goldendocx-0.2.3 lib/goldendocx/tables/row.rb