Sha256: d3ecf62abd5291256ad3d94b48f1d4caabf46fa1b598c4de7b50775cf9645045

Contents?: true

Size: 600 Bytes

Versions: 7

Compression:

Stored size: 600 Bytes

Contents

module OpenXml
  module Docx
    module Elements
      class Family < OpenXml::Docx::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.include? value
        end

      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
openxml-docx-0.11.5 lib/openxml/docx/elements/family.rb
openxml-docx-0.11.4 lib/openxml/docx/elements/family.rb
openxml-docx-0.11.3 lib/openxml/docx/elements/family.rb
openxml-docx-0.11.2 lib/openxml/docx/elements/family.rb
openxml-docx-0.11.1 lib/openxml/docx/elements/family.rb
openxml-docx-0.11.0 lib/openxml/docx/elements/family.rb
openxml-docx-0.11.0.rc lib/openxml/docx/elements/family.rb