Class: PPTX::OPC::ContentTypes

Inherits:
BasePart
  • Object
show all
Defined in:
lib/pptx/opc/content_types.rb

Constant Summary collapse

NS =
'http://schemas.openxmlformats.org/package/2006/content-types'

Instance Method Summary collapse

Methods inherited from BasePart

#base_xml, #content_type, #doc, #initialize, #marshal, #part_name, #template

Constructor Details

This class inherits a constructor from PPTX::OPC::BasePart

Instance Method Details

#set_override(part_name, value) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/pptx/opc/content_types.rb', line 6

def set_override(part_name, value)
  type_list = doc.xpath('c:Types', c: NS).first
  override = type_list.xpath("./xmlns:Override[@PartName='#{part_name}']").first
  unless override
    override = Nokogiri::XML::Node.new('Override', doc)
    override['PartName'] = '/' + part_name
    type_list.add_child(override)
  end
  override['ContentType'] = value
end