Sha256: c59373b9eb58de4c50ce26a1a0c9b252e826e4b6831edb206b1d7ed0b492ac57

Contents?: true

Size: 585 Bytes

Versions: 2

Compression:

Stored size: 585 Bytes

Contents

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

        with_namespace :w do
          attribute :value, expects: :valid_font_family, displays_as: :val
        end

      private

        def valid_font_family(value)
          ok_values = %i(auto decorative modern roman script swiss) # From the spec section 17.18.30
          message = "Invalid font family type (#{value}). Valid options are: #{ok_values.join(", ")}."
          raise ArgumentError, message unless ok_values.inculde? value
        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/family.rb
openxml-docx-0.10.0 lib/openxml/docx/elements/family.rb