Class: OoxmlParser::Slide
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Slide
- Includes:
- SlideHelper
- Defined in:
- lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb
Overview
Class for parsing ‘slide.xml`
Instance Attribute Summary collapse
-
#alternate_content ⇒ Object
Returns the value of attribute alternate_content.
-
#common_slide_data ⇒ CommonSlideData
readonly
Common slide data.
-
#name ⇒ String
readonly
Name of slide.
-
#note ⇒ Notes
readonly
Note of slide.
-
#relationships ⇒ Relationships
readonly
Relationships of slide.
-
#timing ⇒ Object
Returns the value of attribute timing.
-
#transition ⇒ Object
Returns the value of attribute transition.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
- #background ⇒ Object
- #elements ⇒ Object
-
#initialize(parent: nil, xml_path: nil) ⇒ Slide
constructor
A new instance of Slide.
-
#parse ⇒ Slide
Parse Slide object.
- #with_data? ⇒ Boolean
Methods included from SlideHelper
#content_distribute, #content_horizontal_align, #content_vertical_align, #graphic_frames, #nonempty_elements, #transform_of_object
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil, xml_path: nil) ⇒ Slide
Returns a new instance of Slide.
24 25 26 27 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb', line 24 def initialize(parent: nil, xml_path: nil) @parent = parent @xml_path = xml_path end |
Instance Attribute Details
#alternate_content ⇒ Object
Returns the value of attribute alternate_content.
14 15 16 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb', line 14 def alternate_content @alternate_content end |
#common_slide_data ⇒ CommonSlideData (readonly)
Returns common slide data.
16 17 18 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb', line 16 def @common_slide_data end |
#name ⇒ String (readonly)
Returns name of slide.
20 21 22 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb', line 20 def name @name end |
#note ⇒ Notes (readonly)
Returns note of slide.
22 23 24 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb', line 22 def note @note end |
#relationships ⇒ Relationships (readonly)
Returns relationships of slide.
18 19 20 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb', line 18 def relationships @relationships end |
#timing ⇒ Object
Returns the value of attribute timing.
14 15 16 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb', line 14 def timing @timing end |
#transition ⇒ Object
Returns the value of attribute transition.
14 15 16 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb', line 14 def transition @transition end |
Instance Method Details
#background ⇒ Object
41 42 43 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb', line 41 def background @common_slide_data.background end |
#elements ⇒ Object
37 38 39 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb', line 37 def elements @common_slide_data.shape_tree.elements end |
#parse ⇒ Slide
Parse Slide object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb', line 47 def parse OOXMLDocumentObject.add_to_xmls_stack(@xml_path) @name = File.basename(@xml_path, '.*') node = Nokogiri::XML(File.open(OOXMLDocumentObject.current_xml)) node.xpath('//p:sld/*').each do |node_child| case node_child.name when 'cSld' @common_slide_data = CommonSlideData.new(parent: self).parse(node_child) when 'timing' @timing = Timing.new(parent: self).parse(node_child) when 'transition' @transition = Transition.new(parent: self).parse(node_child) when 'AlternateContent' @alternate_content = PresentationAlternateContent.new(parent: self).parse(node_child) end end OOXMLDocumentObject.xmls_stack.pop @relationships = Relationships.parse_rels("#{OOXMLDocumentObject.path_to_folder}#{File.dirname(@xml_path)}/_rels/#{@name}.xml.rels") parse_note self end |
#with_data? ⇒ Boolean
29 30 31 32 33 34 35 |
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb', line 29 def with_data? return true unless background.nil? elements.each do |current_element| return true if current_element.with_data? end false end |