Class: BasicBlock::Formula

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

Instance Method Summary collapse

Constructor Details

#initialize(id:, content:, note:, **args) ⇒ Formula

Returns a new instance of Formula.

Parameters:

Options Hash (**args):

  • :unnumbered (Boolean, nil)
  • :subsequence (String, nil)
  • :inequality (Boolean, nil)
  • :dl (BasicBlock::Dl, nil)


13
14
15
16
17
18
# File 'lib/relaton_iec/basic_block/formula.rb', line 13

def initialize(id:, content:, note:, **args)
  @id = id
  @content = content
  @note = note
  @unnumbered = args[:unnumbered]
end

Instance Method Details

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Builder)


23
24
25
26
27
28
29
30
31
32
# File 'lib/relaton_iec/basic_block/formula.rb', line 23

def to_xml(builder) # rubocop:disable Metrics/CyclomaticComplexity
  f = builder.formula id: @id do |b|
    @content.to_xml b
    @dl&.each { |d| d.to_xml b }
    @note.each { |n| n.to_xml b }
  end
  f[:unnumbered] = @unnumbered if @unnumbered
  f[:subsequence] = @subsequence if @subsequence
  f[:inequality] = @inequality if @ineainequality
end