Sha256: b0be42e4491328b6ed4a289bd2141f2bafef00f4710cdab6116e6df1620ae88f

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require_relative 'common_timing/condition_list'
module OoxmlParser
  # Class for data of CommonTiming
  class CommonTiming < OOXMLDocumentObject
    attr_accessor :id, :duration, :restart, :children, :start_conditions, :end_conditions

    def initialize(parent: nil)
      @children = []
      @start_conditions = []
      @end_conditions = []
      super(parent: parent)
    end

    # Parse CommonTiming object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [CommonTiming] result of parsing
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'dur'
          @duration = value.value
        when 'restart'
          @restart = value.value
        when 'id'
          @id = value.value
        end
      end

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'stCondLst'
          @start_conditions = ConditionList.new(parent: self).parse(node_child)
        when 'endCondLst'
          @end_conditions = ConditionList.new(parent: self).parse(node_child)
        when 'childTnLst'
          @children = TimeNodeList.new(parent: self).parse(node_child).elements
        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/time_node/common_timing.rb
ooxml_parser-0.37.0 lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/time_node/common_timing.rb
ooxml_parser-0.36.1 lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/time_node/common_timing.rb
ooxml_parser-0.36.0 lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/time_node/common_timing.rb