Sha256: 912c61d00ee96dde85b92191fe03aaafa4cb23e1facf2524f24d8ab4640df424

Contents?: true

Size: 895 Bytes

Versions: 4

Compression:

Stored size: 895 Bytes

Contents

module OpenXml
  module DrawingML
    module Elements
      class HeadEnd < OpenXml::Element
        namespace :a
        tag :headEnd

        attribute :length, expects: :valid_end_size, displays_as: :len
        attribute :type, expects: :valid_end_type
        attribute :width, expects: :valid_end_size, displays_as: :w

      private

        def valid_end_size(value)
          ok_values = %i(lg med sm)
          message = "Invalid #{name} (#{value}). Valid values are: #{ok_values.join(", ")}."
          raise ArgumentError, message unless ok_values.include? value
        end

        def valid_end_type(value)
          ok_values = %i(arrow diamond none oval stealth triangle)
          message = "Invalid end type (#{value}). Valid values are: #{ok_values.join(", ")}."
          raise ArgumentError, message unless ok_values.include? value
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
openxml-drawingml-0.3.1 lib/openxml/drawingml/elements/head_end.rb
openxml-drawingml-0.3.0 lib/openxml/drawingml/elements/head_end.rb
openxml-drawingml-0.2.1 lib/openxml/drawingml/elements/head_end.rb
openxml-drawingml-0.2.0 lib/openxml/drawingml/elements/head_end.rb