Sha256: e02826c195f4d8a202d8ac68e7bcd694ac8c49c489f61d4f252b81d6ab73a006

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

Contents

module OpenXml
  module Docx
    module Elements
      class EmbedRegular < Element
        namespace :w

        with_namespace :w do
          attribute :font_key, expects: :bracketed_guid, displays_as: :fontKey
          attribute :subsetted, expects: :true_or_false
        end

        attribute :relationship_id, expects: :string, displays_as: :id, namespace: :r


      private

        def bracketed_guid(value)
          guid_regex = /\{[0-9A-F]{8}\-[0-9A-F]{4}\-[0-9A-F]{4}\-[0-9A-F]{4}\-[0-9A-F]{12}\}/ # Regex taken from spec section 22.9.2.4
          raise ArgumentError, "Not a validly-formatted GUID (#{value})" unless value =~ guid_regex
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
openxml-docx-0.10.1 lib/openxml/docx/elements/embed_regular.rb
openxml-docx-0.10.0 lib/openxml/docx/elements/embed_regular.rb