Class: BasicBlock::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton_iec/basic_block/table.rb

Defined Under Namespace

Classes: TabCell, Td, Th, Tr

Instance Method Summary collapse

Constructor Details

#initialize(id:, tbody:, note:, **args) ⇒ Table

Returns a new instance of Table.

Parameters:

Options Hash (**args):



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/relaton_iec/basic_block/table.rb', line 18

def initialize(id:, tbody:, note:, **args) # rubocop:disable Metrics/MethodLength
  @id = id
  @unnumbered = args[:unnumbered]
  @subsequence = args[:subsequence]
  @alt = args[:alt]
  @summary = args[:summary]
  @uri = args[:uri]
  @tname = args[:tname]
  @thead = args[:thead]
  @tbody = tbody
  @tfoot = args[:tfoot]
  @note = note
  @dl = args[:dl]
end

Instance Method Details

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder)


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/relaton_iec/basic_block/table.rb', line 34

def to_xml(builder) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
  tab = builder.table id: @id do |b|
    b.name { @tname.to_xml b } if @tname
    b.thead { @thead.to_xml b } if @thead
    @tbody.each { |tb| tb.to_xml b }
    b.name { @tfoot.to_xml b } if @tfoot
    @note.each { |n| b.note { n.to_xml b } }
    @dl.to_xml b
  end
  tab[:unnumbered] = @unnumbered if @unnumbered
  tab[:subsequence] = @subsequence if @subsequence
  tab[:alt] = @alt if @alt
  tab[:summary] = @summary if @summary
  tab[:uri] = @uri if @uri
end