Sha256: b6227851895ea81f14506d9aeb8e754f1ce448337cd2af1ea14846801df8e005

Contents?: true

Size: 571 Bytes

Versions: 14

Compression:

Stored size: 571 Bytes

Contents

module OpenXml
  module Docx
    module Properties
      class Language < ComplexProperty
        tag :lang

        with_namespace :w do
          attribute :bidi, expects: :valid_language
          attribute :east_asia, expects: :valid_language
          attribute :latin, expects: :valid_language, displays_as: :val
        end

      private

        def valid_language(value)
          message = "Invalid #{name}: must be a language code (RFC 4646)"
          raise ArgumentError, message unless value =~ /[a-z]{2}-[A-Z]{2}/
        end

      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
openxml-docx-0.11.5 lib/openxml/docx/properties/language.rb
openxml-docx-0.11.4 lib/openxml/docx/properties/language.rb
openxml-docx-0.11.3 lib/openxml/docx/properties/language.rb
openxml-docx-0.11.2 lib/openxml/docx/properties/language.rb
openxml-docx-0.11.1 lib/openxml/docx/properties/language.rb
openxml-docx-0.11.0 lib/openxml/docx/properties/language.rb
openxml-docx-0.11.0.rc lib/openxml/docx/properties/language.rb
openxml-docx-0.10.6 lib/openxml/docx/properties/language.rb
openxml-docx-0.10.5 lib/openxml/docx/properties/language.rb
openxml-docx-0.10.4 lib/openxml/docx/properties/language.rb
openxml-docx-0.10.3 lib/openxml/docx/properties/language.rb
openxml-docx-0.10.2 lib/openxml/docx/properties/language.rb
openxml-docx-0.10.1 lib/openxml/docx/properties/language.rb
openxml-docx-0.10.0 lib/openxml/docx/properties/language.rb