Sha256: ec71e4e8ca5608e58d4727481148bce2dc9e068986c7765437bb453889cb050c

Contents?: true

Size: 992 Bytes

Versions: 8

Compression:

Stored size: 992 Bytes

Contents

# frozen_string_literal: true

require_relative 'tile'
module OoxmlParser
  # Class for working with Image Fill
  class ImageFill < OOXMLDocumentObject
    attr_accessor :stretch, :tile, :properties
    # @return [FileReference] image structure
    attr_accessor :file_reference

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

    # Parse ImageFill object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [ImageFill] result of parsing
    def parse(node)
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'blip'
          @file_reference = FileReference.new(parent: self).parse(node_child)
        when 'tile'
          @tile = Tile.new(OOXMLCoordinates.parse(node_child, x_attr: 'tx', y_attr: 'ty'),
                           OOXMLCoordinates.parse(node_child, x_attr: 'sx', y_attr: 'sy'),
                           parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ooxml_parser-0.8.1 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.8.0 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.7.2 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.7.1 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.7.0 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.6.0 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.5.1 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.5.0 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb