Sha256: c08f97dd3d080d575d3cdeeba9a932b26be9d805473c1c6d461742ec001d8f19

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

require_relative 'shape_style/effect_reference'
require_relative 'shape_style/fill_reference'
require_relative 'shape_style/font_reference'
require_relative 'shape_style/line_reference'
module OoxmlParser
  # Class for parsing `wps:style` tags
  class ShapeStyle < OOXMLDocumentObject
    # @return [FillReference] effect reference
    attr_reader :effect_reference
    # @return [FillReference] fill reference
    attr_reader :fill_reference
    # @return [FontReference] font reference
    attr_reader :font_reference
    # @return [LineReference] line reference
    attr_reader :line_reference

    def initialize(parent: nil)
      @parent = parent
    end

    # Parse ShapeStyle object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [ShapeStyle] result of parsing
    def parse(node)
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'effectRef'
          @effect_reference = EffectReference.new(parent: self).parse(node_child)
        when 'fillRef'
          @fill_reference = FillReference.new(parent: self).parse(node_child)
        when 'fontRef'
          @font_reference = FontReference.new(parent: self).parse(node_child)
        when 'lnRef'
          @line_reference = LineReference.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ooxml_parser-0.8.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb
ooxml_parser-0.8.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb
ooxml_parser-0.7.2 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb
ooxml_parser-0.7.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb
ooxml_parser-0.7.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb
ooxml_parser-0.6.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb