Sha256: 7db1f4d202a9d84a2e2f50fe6f2c7f2972bdc264636101db173e0c712a7b5aa5

Contents?: true

Size: 1.25 KB

Versions: 7

Compression:

Stored size: 1.25 KB

Contents

module OpenXml
  module DrawingML
    module Elements
      class Outline < OpenXml::Docx::Elements::Container
        namespace :a
        tag :ln

        attribute :alignment, expects: :valid_stroke_alignment, displays_as: :algn
        attribute :cap, expects: :valid_cap_type
        attribute :compound_type, expects: :valid_compound_type, displays_as: :cmpd
        attribute :width, expects: :positive_integer, displays_as: :w

      private

        def valid_stroke_alignment(value)
          ok_values = %i(ctr in)
          message = "Invalid stroke alignment (#{value}). Valid values are: #{ok_values.join(", ")}."
          raise ArgumentError, message unless ok_values.include? value
        end

        def valid_cap_type(value)
          ok_values = %i(flat rnd sq)
          message = "Invalid line cap type (#{value}). Valid values are: #{ok_values.join(", ")}."
          raise ArgumentError, message unless ok_values.include? value
        end

        def valid_compound_type(value)
          ok_values = %i(dbl sng thickThin thinThick tri)
          message = "Invalid compound line type (#{value}). Valid values 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.10.6 lib/openxml/drawingml/elements/outline.rb
openxml-docx-0.10.5 lib/openxml/drawingml/elements/outline.rb
openxml-docx-0.10.4 lib/openxml/drawingml/elements/outline.rb
openxml-docx-0.10.3 lib/openxml/drawingml/elements/outline.rb
openxml-docx-0.10.2 lib/openxml/drawingml/elements/outline.rb
openxml-docx-0.10.1 lib/openxml/drawingml/elements/outline.rb
openxml-docx-0.10.0 lib/openxml/drawingml/elements/outline.rb