Class: BasicBlock::Table::TabCell
- Inherits:
-
Object
- Object
- BasicBlock::Table::TabCell
- Defined in:
- lib/relaton_iec/basic_block/table.rb
Constant Summary collapse
- ALIGNS =
%w[left right ceter].freeze
- VALIGNS =
%w[top middle bottom baseline].freeze
Instance Method Summary collapse
-
#initialize(content, **args) ⇒ TabCell
constructor
A new instance of TabCell.
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(content, **args) ⇒ TabCell
Returns a new instance of TabCell.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/relaton_iec/basic_block/table.rb', line 75 def initialize(content, **args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength if args[:align] && !ALIGNS.include?(args[:align]) Util.warn "invalid table/tr/td align `#{args[:align]}`\n" \ "alloved aligns are: `#{ALIGNS.join '`, `'}`" end if args[:valign] && !VALIGNS.include?(args[:valign]) Util.warn "invalid table/tr/td valign `#{args[:valign]}`\n" \ "alloved valigns are: `#{VALIGNS.join '`, `'}`" end @content = content @colspan = args[:colspan] @rowspan = args[:rowspan] @align = args[:align] @valign = args[:valign] end |
Instance Method Details
#to_xml(builder) ⇒ Object
92 93 94 95 96 97 98 |
# File 'lib/relaton_iec/basic_block/table.rb', line 92 def to_xml(builder) td = @content.each { |c| c.to_xml builder } td[:colspan] = @colspan if @colspan td[:rowspan] = @rowspan if @rowspan td[:align] = @align if @align td[:valign] = @valign if @valign end |