Sha256: 78b2ad98e12622101296ee22f6c0943b128346affe393c613ea05a4c12eec85e

Contents?: true

Size: 1.1 KB

Versions: 45

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require_relative 'transition/sound_action'
require_relative 'transition_properties/transition_properties'
module OoxmlParser
  # Class for data of Transition
  class Transition < OOXMLDocumentObject
    attr_accessor :speed, :properties, :sound_action, :advance_on_click, :delay, :duration

    # Parse Transition object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [Transition] result of parsing
    def parse(node)
      node.xpath('*').each do |node_child|
        @properties = TransitionProperties.new(parent: self).parse(node_child)
        case node_child.name
        when 'sndAc'
          @sound_action = SoundAction.new(parent: self).parse(node_child)
        end
      end
      node.attributes.each do |key, value|
        case key
        when 'spd'
          @speed = value.value.to_sym
        when 'advClick'
          @advance_on_click = attribute_enabled?(value)
        when 'advTm'
          @delay = value.value.to_f / 1_000.0
        when 'dur'
          @duration = value.value.to_f / 1_000.0
        end
      end
      self
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
ooxml_parser-0.21.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.20.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.19.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.18.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.18.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.17.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.16.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.15.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.14.2 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.14.1-mingw32 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.14.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.14.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.13.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.12.2 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.12.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.12.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.11.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.10.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.9.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb
ooxml_parser-0.9.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb