openxml/openxml-docx

View on GitHub
lib/openxml/docx/properties/numbering.rb

Summary

Maintainability
A
0 mins
Test Coverage
module OpenXml
  module Docx
    module Properties
      class Numbering < ComplexProperty
        tag :numPr

        with_namespace :w do
          attribute :level, expects: :positive_integer, displays_as: :ilvl
          attribute :id, expects: :positive_integer, displays_as: :numId
        end

        def to_xml(xml)
          return unless render?
          xml["w"].public_send(tag) {
            xml_attributes.each do |tag_name, value|
              xml.public_send(tag_name, "w:val" => value)
            end
          }
        end

      end
    end
  end
end