Sha256: 4fc8cbee63c040c3d25e356d607e9e487c38a0d3c5503221436d2326818b517f

Contents?: true

Size: 655 Bytes

Versions: 6

Compression:

Stored size: 655 Bytes

Contents

module BasicBlock
  class Stem
    TYPES = %w[MathML AsciiMath].freeze

    # @return [String]
    attr_reader :type

    #
    # @param [String] type
    # @param [Array<#to_xml>] content any element
    #
    def initialize(type:, content: [])
      unless TYPES.include? type
        warn "[relaton-iec] WARNING: Invalud type: \"#{type}\""
        warn "[relaton-iec] Allowed types are: #{TYPES.join ', '}"
      end
      @type = type
      @content = content
    end

    #
    # @param [Nokogiri::XML::Builder] builder
    #
    def to_xml(builder)
      builder.stem(type) do |b|
        content.each { |c| c.to_xml b }
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
relaton-iec-1.18.1 lib/relaton_iec/basic_block/stem.rb
relaton-iec-1.18.0 lib/relaton_iec/basic_block/stem.rb
relaton-iec-1.17.0 lib/relaton_iec/basic_block/stem.rb
relaton-iec-1.16.4 lib/relaton_iec/basic_block/stem.rb
relaton-iec-1.16.3 lib/relaton_iec/basic_block/stem.rb
relaton-iec-1.16.2 lib/relaton_iec/basic_block/stem.rb