Sha256: e18bd0f62996299e3d5b4f31b6107fb01069d808c95d85094b69cae89dcfe6a2

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

require_relative 'time_node_list/time_node'
module OoxmlParser
  # Class for parsing TimeNodeList object <p:tnLst>
  class TimeNodeList < OOXMLDocumentObject
    # @return [Array<Object>] list of elements
    attr_reader :elements

    def initialize(parent: nil)
      @elements = []
      super
    end

    # Parse TimeNodeList
    # @param node [Nokogiri::XML::Element] node to parse
    # @return [TimeNodeList] value of TimeNodeList
    def parse(node)
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'par'
          @elements << TimeNode.new(:parallel, parent: self).parse(node_child)
        when 'seq'
          @elements << TimeNode.new(:sequence, parent: self).parse(node_child)
        when 'anim'
          @elements << TimeNode.new(:animate, parent: self).parse(node_child)
        when 'set'
          @elements << SetTimeNode.new(parent: self).parse(node_child)
        when 'animEffect'
          @elements << AnimationEffect.new(parent: self).parse(node_child)
        when 'video'
          @elements << :video
        when 'audio'
          @elements << TimeNode.new(:audio, 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.37.1 lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list.rb
ooxml_parser-0.37.0 lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list.rb
ooxml_parser-0.36.1 lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list.rb
ooxml_parser-0.36.0 lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list.rb