Class: Odf::Document::Abstract
- Inherits:
-
Object
- Object
- Odf::Document::Abstract
- Defined in:
- lib/odf/document/abstract.rb
Direct Known Subclasses
Constant Summary collapse
- COMPONENTS =
[:content, :manifest, :meta, :mime_type, :styles, :settings]
Instance Attribute Summary collapse
-
#creator ⇒ Object
Returns the creator information.
Instance Method Summary collapse
- #add_image(uri) ⇒ Object
-
#components ⇒ Object
Returns the components of the document.
-
#extension ⇒ Object
Returns the file extension for open document format.
-
#initialize ⇒ Abstract
constructor
A new instance of Abstract.
-
#media_type ⇒ Object
Returns the mime type of document.
- #root ⇒ Object
-
#serialize(file_name) ⇒ Object
Serialize the document to given path.
-
#to_blob ⇒ Object
Returns the output stream.
- #wrapper ⇒ Object
Constructor Details
#initialize ⇒ Abstract
Returns a new instance of Abstract.
11 12 13 14 15 16 17 18 19 |
# File 'lib/odf/document/abstract.rb', line 11 def initialize @content = Odf::Component::Content.new(self) @image_set = Odf::Component::ImageSet.new(self) @manifest = Odf::Component::Manifest.new(self) @meta = Odf::Component::Meta.new(self) @mime_type = Odf::Component::MimeType.new(self) @settings = Odf::Component::Settings.new(self) @styles = Odf::Component::Styles.new(self) end |
Instance Attribute Details
Instance Method Details
#add_image(uri) ⇒ Object
58 59 60 |
# File 'lib/odf/document/abstract.rb', line 58 def add_image(uri) image_set << uri end |
#components ⇒ Object
Returns the components of the document.
39 40 41 |
# File 'lib/odf/document/abstract.rb', line 39 def components COMPONENTS end |
#extension ⇒ Object
Returns the file extension for open document format.
30 31 32 |
# File 'lib/odf/document/abstract.rb', line 30 def extension self.class::EXTENSION end |
#media_type ⇒ Object
Returns the mime type of document. All subclasses of this abstract class should define the MIME_TYPE
constant.
24 25 26 |
# File 'lib/odf/document/abstract.rb', line 24 def media_type self.class::MIME_TYPE end |
#root ⇒ Object
62 63 64 |
# File 'lib/odf/document/abstract.rb', line 62 def root content.root end |
#serialize(file_name) ⇒ Object
Serialize the document to given path.
49 50 51 |
# File 'lib/odf/document/abstract.rb', line 49 def serialize(file_name) Odf::Utils::File.serialize(file_name, self) && true end |
#to_blob ⇒ Object
Returns the output stream.
54 55 56 |
# File 'lib/odf/document/abstract.rb', line 54 def to_blob Odf::Utils::File.output_stream(self) end |
#wrapper ⇒ Object
34 35 36 |
# File 'lib/odf/document/abstract.rb', line 34 def wrapper self.class::WRAPPER end |