Sha256: 8abf94689bc4e8ff7f2e1a201b31636a4dda4f00c1ec47be3fa1c36c9842fbdc

Contents?: true

Size: 968 Bytes

Versions: 4

Compression:

Stored size: 968 Bytes

Contents

require_relative 'transition/transition'
module OoxmlParser
  # Class for parsing `AlternateContent`
  class PresentationAlternateContent < OOXMLDocumentObject
    attr_accessor :transition, :timing, :elements

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

    # Parse PresentationAlternateContent object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [PresentationAlternateContent] result of parsing
    def parse(node)
      node.xpath('mc:Choice/*', 'xmlns:mc' => 'http://schemas.openxmlformats.org/markup-compatibility/2006').each do |node_child|
        case node_child.name
        when 'timing'
          @timing = Timing.new(parent: self).parse(node_child)
        when 'transition'
          @transition = Transition.new(parent: self).parse(node_child)
        when 'sp'
          @elements << DocxShape.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ooxml_parser-0.4.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb
ooxml_parser-0.4.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb
ooxml_parser-0.3.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb
ooxml_parser-0.2.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb