Class: OoxmlParser::ImageFill

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb

Overview

Class for working with Image Fill

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ ImageFill

Returns a new instance of ImageFill.



11
12
13
14
# File 'lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb', line 11

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

Instance Attribute Details

#file_referenceFileReference

Returns image structure.

Returns:



9
10
11
# File 'lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb', line 9

def file_reference
  @file_reference
end

#propertiesObject

Returns the value of attribute properties.



7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb', line 7

def properties
  @properties
end

#stretchObject

Returns the value of attribute stretch.



7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb', line 7

def stretch
  @stretch
end

#tileObject

Returns the value of attribute tile.



7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb', line 7

def tile
  @tile
end

Instance Method Details

#parse(node) ⇒ ImageFill

Parse ImageFill object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb', line 19

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.new(parent: self).parse(node_child, x_attr: 'tx', y_attr: 'ty'),
                       OOXMLCoordinates.new(parent: self).parse(node_child, x_attr: 'sx', y_attr: 'sy'),
                       parent: self).parse(node_child)
    end
  end
  self
end