class OoxmlParser::Background

Class for parsing ‘bg` tag

Attributes

fill[RW]
properties[RW]

@return [BackgroundProperties] properties

shade_to_title[RW]

Public Class Methods

new(type = nil, parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/pptx_parser/presentation/slide/background.rb, line 11
def initialize(type = nil, parent: nil)
  @type = type
  super(parent: parent)
end

Public Instance Methods

parse(node) click to toggle source

Parse Background object @param node [Nokogiri::XML:Element] node to parse @return [Background] result of parsing

# File lib/ooxml_parser/pptx_parser/presentation/slide/background.rb, line 19
def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'bgPr'
      @properties = BackgroundProperties.new(parent: self).parse(node_child)
    end
  end

  background_properties_node = node.xpath('p:bgPr').first
  if background_properties_node
    @shade_to_title = attribute_enabled?(background_properties_node, 'shadeToTitle')
    @fill = PresentationFill.new(parent: self).parse(background_properties_node)
  end
  self
end