Sha256: dbe3673f68119e0d365cb81b93f61360e6031f00c900b69febd7f31bb1872b2b

Contents?: true

Size: 553 Bytes

Versions: 3

Compression:

Stored size: 553 Bytes

Contents

module OpenXml
  module Docx
    module Elements
      class Text < Element
        attr_reader :text

        tag :t

        attribute :space, expects: :valid_space_preserve, namespace: :xml

        VALID_SPACE_PRESERVES = [:preserve, nil]

        def initialize(text=nil)
          @text = text
        end

        def to_xml(xml)
          xml["w"].public_send(tag, text, xml_attributes)
        end

      private

        def valid_space_preserve(value)
          valid_in? value, VALID_SPACE_PRESERVES
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
openxml-docx-0.9.0 lib/openxml/docx/elements/text.rb
openxml-docx-0.8.0 lib/openxml/docx/elements/text.rb
openxml-docx-0.8.0.beta1 lib/openxml/docx/elements/text.rb