Class: PPTX::OPC::BasePart

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

Overview

A part without relationships.

Direct Known Subclasses

BinaryPart, ContentTypes, Part, Relationships

Instance Method Summary collapse

Constructor Details

#initialize(package, part_name) ⇒ BasePart

Returns a new instance of BasePart.



5
6
7
8
9
# File 'lib/pptx/opc/base_part.rb', line 5

def initialize(package, part_name)
  @package = package
  @part_name = part_name
  package.set_part(part_name, self, content_type)
end

Instance Method Details

#base_xmlObject



11
12
13
# File 'lib/pptx/opc/base_part.rb', line 11

def base_xml
  nil
end

#content_typeObject



15
16
17
# File 'lib/pptx/opc/base_part.rb', line 15

def content_type
  nil
end

#docObject



19
20
21
# File 'lib/pptx/opc/base_part.rb', line 19

def doc
  @doc ||= Nokogiri::XML(template || base_xml)
end

#marshalObject



23
24
25
# File 'lib/pptx/opc/base_part.rb', line 23

def marshal
  doc.to_s
end

#part_nameObject



27
28
29
# File 'lib/pptx/opc/base_part.rb', line 27

def part_name
  @part_name
end

#templateObject



31
32
33
# File 'lib/pptx/opc/base_part.rb', line 31

def template
  @package.template_part(@part_name)
end