Sha256: 8a0e88f0863ddfa3ec273e29cb374727ad3196fb12f66e695b6bc6506e6ffc55

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

module OpenXml
  module DrawingML
    module Elements
      class Outline < OpenXml::Element
        include HasChildren
        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

4 entries across 4 versions & 1 rubygems

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