Class: OoxmlParser::ImageFill
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::ImageFill
- Defined in:
- lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
Constant Summary
Constants inherited from OOXMLDocumentObject
OOXMLDocumentObject::DEFAULT_DIRECTORY_FOR_MEDIA
Instance Attribute Summary collapse
-
#path ⇒ Object
(also: #path_to_media_file)
Returns the value of attribute path.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#stretch ⇒ Object
Returns the value of attribute stretch.
-
#tile ⇒ Object
Returns the value of attribute tile.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path = '') ⇒ ImageFill
constructor
A new instance of ImageFill.
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, copy_media_file, current_xml, dir, encrypted_file?, get_link_from_rels, media_folder, option_enabled?, unzip_file
Constructor Details
#initialize(path = '') ⇒ ImageFill
Returns a new instance of ImageFill.
10 11 12 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb', line 10 def initialize(path = '') @path = path end |
Instance Attribute Details
#path ⇒ Object Also known as: path_to_media_file
Returns the value of attribute path.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb', line 6 def path @path end |
#properties ⇒ Object
Returns the value of attribute properties.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb', line 6 def properties @properties end |
#stretch ⇒ Object
Returns the value of attribute stretch.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb', line 6 def stretch @stretch end |
#tile ⇒ Object
Returns the value of attribute tile.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb', line 6 def tile @tile end |
Class Method Details
.parse(blip_fill_node) ⇒ Object
14 15 16 17 18 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 14 def self.parse(blip_fill_node) image = ImageFill.new blip_fill_node.xpath('*').each do |blip_fill_node_child| case blip_fill_node_child.name when 'blip' next unless blip_fill_node_child.attribute('embed') path_to_original_image = OOXMLDocumentObject.get_link_from_rels(blip_fill_node_child.attribute('embed').value) FileUtils.copy(dir + path_to_original_image, OOXMLDocumentObject.media_folder + File.basename(path_to_original_image)) image.path = OOXMLDocumentObject.media_folder + File.basename(path_to_original_image) image.properties = ImageProperties.parse(blip_fill_node_child) when 'stretch' image.stretch = Stretching.parse(blip_fill_node_child) # !blip_fill_node_child.xpath('a:fillRect').first.nil? when 'tile' image.tile = Tile.parse(blip_fill_node_child) end end image end |