Sha256: 553943d644075f8bec2be0255b6f21834a59a7da5226e6c7ea157ed40e4a9cb8

Contents?: true

Size: 611 Bytes

Versions: 3

Compression:

Stored size: 611 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
        Util.warn "Invalud type: `#{type}`\nAllowed 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

3 entries across 3 versions & 1 rubygems

Version Path
relaton-iec-1.20.0 lib/relaton_iec/basic_block/stem.rb
relaton-iec-1.19.1 lib/relaton_iec/basic_block/stem.rb
relaton-iec-1.19.0 lib/relaton_iec/basic_block/stem.rb