Class: PureDocx::Constructors::Rels
- Inherits:
-
Object
- Object
- PureDocx::Constructors::Rels
- Defined in:
- lib/puredocx/constructors/rels.rb
Constant Summary collapse
- DOCUMENT_RELATIONSHIPS =
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/'.freeze
- PACKAGE__RELATIONSHIPS =
'http://schemas.openxmlformats.org/package/2006/relationships/'.freeze
- BASIC_RELS =
{ 'docProps/core.xml' => "#{PACKAGE__RELATIONSHIPS}metadata/core-properties", 'docProps/app.xml' => "#{DOCUMENT_RELATIONSHIPS}extended-properties" }.freeze
- WORD_RELS =
{ 'endnotes.xml' => "#{DOCUMENT_RELATIONSHIPS}endnotes", 'footnotes.xml' => "#{DOCUMENT_RELATIONSHIPS}footnotes", 'header1.xml' => "#{DOCUMENT_RELATIONSHIPS}header", 'footer1.xml' => "#{DOCUMENT_RELATIONSHIPS}footer", 'styles.xml' => "#{DOCUMENT_RELATIONSHIPS}styles", 'settings.xml' => "#{DOCUMENT_RELATIONSHIPS}settings", 'webSettings.xml' => "#{DOCUMENT_RELATIONSHIPS}webSettings", 'fontTable.xml' => "#{DOCUMENT_RELATIONSHIPS}fontTable", 'theme/theme1.xml' => "#{DOCUMENT_RELATIONSHIPS}theme" }.freeze
Instance Attribute Summary collapse
-
#basic_rels ⇒ Object
Returns the value of attribute basic_rels.
-
#header_rels ⇒ Object
Returns the value of attribute header_rels.
-
#word_rels ⇒ Object
Returns the value of attribute word_rels.
Instance Method Summary collapse
-
#initialize ⇒ Rels
constructor
A new instance of Rels.
- #prepare_basic_rels! ⇒ Object
- #prepare_header_rels!(file_path, file_name) ⇒ Object
- #prepare_word_rels!(file_path, file_name) ⇒ Object
- #rels ⇒ Object
Constructor Details
#initialize ⇒ Rels
Returns a new instance of Rels.
24 25 26 27 28 |
# File 'lib/puredocx/constructors/rels.rb', line 24 def initialize @basic_rels = BASIC_RELS.dup @word_rels = WORD_RELS.dup @header_rels = {} end |
Instance Attribute Details
#basic_rels ⇒ Object
Returns the value of attribute basic_rels.
22 23 24 |
# File 'lib/puredocx/constructors/rels.rb', line 22 def basic_rels @basic_rels end |
#header_rels ⇒ Object
Returns the value of attribute header_rels.
22 23 24 |
# File 'lib/puredocx/constructors/rels.rb', line 22 def header_rels @header_rels end |
#word_rels ⇒ Object
Returns the value of attribute word_rels.
22 23 24 |
# File 'lib/puredocx/constructors/rels.rb', line 22 def word_rels @word_rels end |
Instance Method Details
#prepare_basic_rels! ⇒ Object
38 39 40 |
# File 'lib/puredocx/constructors/rels.rb', line 38 def prepare_basic_rels! basic_rels.merge!('word/document.xml' => "#{DOCUMENT_RELATIONSHIPS}officeDocument") end |
#prepare_header_rels!(file_path, file_name) ⇒ Object
46 47 48 |
# File 'lib/puredocx/constructors/rels.rb', line 46 def prepare_header_rels!(file_path, file_name) header_rels.merge! prepare_rels_for_attached_image(file_path, file_name) end |
#prepare_word_rels!(file_path, file_name) ⇒ Object
42 43 44 |
# File 'lib/puredocx/constructors/rels.rb', line 42 def prepare_word_rels!(file_path, file_name) word_rels.merge! prepare_rels_for_attached_image(file_path, file_name) end |
#rels ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/puredocx/constructors/rels.rb', line 30 def rels { basic_rels: basic_rels, word_rels: word_rels, header_rels: header_rels } end |