Class: PowerPointPptx::Slide

Inherits:
Object
  • Object
show all
Defined in:
lib/power_point_pptx/slide.rb

Overview

Represents a slide in a PowerPoint presentation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry, entry_name) ⇒ Slide

Returns a new instance of Slide.



11
12
13
14
15
# File 'lib/power_point_pptx/slide.rb', line 11

def initialize(entry, entry_name)
  @entry_name = entry_name
  @xml = entry.get_input_stream.read
  @parsed_xml = Nokogiri::XML::Document.parse @xml
end

Instance Attribute Details

#entry_nameObject (readonly)

Returns the value of attribute entry_name.



8
9
10
# File 'lib/power_point_pptx/slide.rb', line 8

def entry_name
  @entry_name
end

#parsed_xmlObject (readonly)

Returns the value of attribute parsed_xml.



8
9
10
# File 'lib/power_point_pptx/slide.rb', line 8

def parsed_xml
  @parsed_xml
end

#xmlObject

Returns the value of attribute xml.



8
9
10
# File 'lib/power_point_pptx/slide.rb', line 8

def xml
  @xml
end

Instance Method Details

#contentObject



17
18
19
# File 'lib/power_point_pptx/slide.rb', line 17

def content
  parsed_xml.xpath("//a:t").collect(&:text)
end

#content=(content) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/power_point_pptx/slide.rb', line 21

def content=(content)
  parsed_xml.xpath("//a:t").each_with_index do |node, index|
    node.content = content[index]
  end

  @xml = parsed_xml.to_xml
end