Class: BasicBlock::Index

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

Instance Method Summary collapse

Constructor Details

#initialize(primary:, **args) ⇒ Index

Returns a new instance of Index.

Parameters:

Options Hash (**args):



10
11
12
13
14
15
# File 'lib/relaton_iec/basic_block/index.rb', line 10

def initialize(primary:, **args)
  @to = args[:to]
  @primary = primary
  @secondary = args[:secondary]
  @tertiary = args[:tertiary]
end

Instance Method Details

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder)


18
19
20
21
22
23
24
25
# File 'lib/relaton_iec/basic_block/index.rb', line 18

def to_xml(builder) # rubocop:disable Metrics/CyclomaticComplexity
  idx = builder.index do |b|
    @primary.each { |p| p.to_xml b }
    @secondary&.each { |s| s.to_xml b }
    @tertiary&.each { |t| t.to_xml b }
  end
  idx[:to] = @to if @to
end