Sha256: 8eb40ae975a5027357b8d47c4720409c69b702737262140dc440af012541544a

Contents?: true

Size: 863 Bytes

Versions: 3

Compression:

Stored size: 863 Bytes

Contents

# frozen_string_literal: true

module OoxmlParser
  # Fallback DOCX Shape Properties
  class OldDocxShapeProperties < OOXMLDocumentObject
    attr_accessor :fill_color, :opacity, :stroke_color, :stroke_weight

    # Parse OldDocxShapeProperties object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [OldDocxShapeProperties] result of parsing
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'fillcolor'
          @fill_color = Color.new(parent: self).parse_hex_string(value.value.delete('#'))
        when 'opacity'
          @opacity = value.value.to_f
        when 'strokecolor'
          @stroke_color = Color.new(parent: self).parse_hex_string(value.value.delete('#'))
        when 'strokeweight'
          @stroke_weight = value.value.to_f
        end
      end
      self
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ooxml_parser-0.6.0 lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb
ooxml_parser-0.5.1 lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb
ooxml_parser-0.5.0 lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb