Class: Ballmer::Document
- Inherits:
-
Object
- Object
- Ballmer::Document
- Extended by:
- Forwardable
- Defined in:
- lib/ballmer/document.rb,
lib/ballmer/document/part.rb,
lib/ballmer/document/rels.rb,
lib/ballmer/document/archive.rb,
lib/ballmer/document/xml_part.rb,
lib/ballmer/document/content_types.rb
Overview
Deals with file concerns between higher-level classes like Slides, Notes and file-system level work.
Direct Known Subclasses
Defined Under Namespace
Classes: Archive, ContentTypes, Part, Rels, XMLPart
Instance Attribute Summary collapse
-
#archive ⇒ Object
readonly
Make the archive available in case the developer needs to perform even lower level IO functions.
Class Method Summary collapse
-
.open(path) ⇒ Object
Open an XML office file from the given path.
-
.read(data) ⇒ Object
Read zip data from a bufffer.
Instance Method Summary collapse
-
#content_types ⇒ Object
Content types XML file.
-
#edit_xml(path, &block) ⇒ Object
Modify XML within a block and write it back to the zip when done.
-
#initialize(archive) ⇒ Document
constructor
A new instance of Document.
-
#xml(path) ⇒ Object
Open an XML document at the given path.
Constructor Details
#initialize(archive) ⇒ Document
Returns a new instance of Document.
22 23 24 |
# File 'lib/ballmer/document.rb', line 22 def initialize(archive) @archive = archive end |
Instance Attribute Details
#archive ⇒ Object (readonly)
Make the archive available in case the developer needs to perform even lower level IO functions.
20 21 22 |
# File 'lib/ballmer/document.rb', line 20 def archive @archive end |
Class Method Details
Instance Method Details
#content_types ⇒ Object
Content types XML file.
48 49 50 |
# File 'lib/ballmer/document.rb', line 48 def content_types ContentTypes.new(self) end |
#edit_xml(path, &block) ⇒ Object
Modify XML within a block and write it back to the zip when done.
43 44 45 |
# File 'lib/ballmer/document.rb', line 43 def edit_xml(path, &block) write path, xml(path).tap(&block).to_s end |
#xml(path) ⇒ Object
Open an XML document at the given path.
38 39 40 |
# File 'lib/ballmer/document.rb', line 38 def xml(path) Nokogiri::XML read path end |