Sha256: 5c3f5b3c7b6727fbaa0a04d18d5849c4e6d76417440b014b49317d487215d2ec

Contents?: true

Size: 935 Bytes

Versions: 2

Compression:

Stored size: 935 Bytes

Contents

module OoxmlParser
  class TargetElement
    attr_accessor :type, :id, :name, :built_in

    def initialize(type = '', id = '')
      @type = type
      @id = id
    end

    def self.parse(target_node)
      target = TargetElement.new
      target_node.xpath('*').each do |target_node_child|
        case target_node_child.name
        when 'sldTgt'
          target.type = :slide
        when 'sndTgt'
          target.type = :sound
          target.name = target_node_child.attribute('name').value
          target.built_in = target_node_child.attribute('builtIn').value ? StringHelper.to_bool(target_node_child.attribute('builtIn').value) : false
        when 'spTgt'
          target.type = :shape
          target.id = target_node_child.attribute('spid').value
        when 'inkTgt'
          target.type = :ink
          target.id = target_node_child.attribute('spid').value
        end
      end
      target
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ooxml_parser-0.1.2 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb
ooxml_parser-0.1.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb