Class: Docxi::Word::Hyperlinks::Hyperlink
- Inherits:
-
Object
- Object
- Docxi::Word::Hyperlinks::Hyperlink
- Defined in:
- lib/docxi/word/hyperlinks/hyperlink.rb
Defined Under Namespace
Classes: Hyperlink
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#sequence ⇒ Object
Returns the value of attribute sequence.
Instance Method Summary collapse
- #content_type ⇒ Object
- #hyperlink(text, link) ⇒ Object
-
#initialize(id, options = {}) ⇒ Hyperlink
constructor
A new instance of Hyperlink.
- #render(zip) ⇒ Object
- #set_sequence(sequence) ⇒ Object
- #target ⇒ Object
Constructor Details
#initialize(id, options = {}) ⇒ Hyperlink
Returns a new instance of Hyperlink.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/docxi/word/hyperlinks/hyperlink.rb', line 9 def initialize(id,={}) @options = @id = id if block_given? yield self else end end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/docxi/word/hyperlinks/hyperlink.rb', line 8 def id @id end |
#sequence ⇒ Object
Returns the value of attribute sequence.
8 9 10 |
# File 'lib/docxi/word/hyperlinks/hyperlink.rb', line 8 def sequence @sequence end |
Instance Method Details
#content_type ⇒ Object
25 26 27 |
# File 'lib/docxi/word/hyperlinks/hyperlink.rb', line 25 def content_type "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" end |
#hyperlink(text, link) ⇒ Object
42 43 44 45 |
# File 'lib/docxi/word/hyperlinks/hyperlink.rb', line 42 def hyperlink(text,link) text = Hyperlink.new(text, link, id) @content << text end |
#render(zip) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/docxi/word/hyperlinks/hyperlink.rb', line 33 def render(zip) zip.put_next_entry("word/#{target}") zip.write(Docxi.to_xml(document)) if !@relationships.empty? zip.put_next_entry("word/_rels/#{target}.rels") zip.write(Docxi.to_xml(relationships)) end end |
#set_sequence(sequence) ⇒ Object
20 21 22 23 |
# File 'lib/docxi/word/hyperlinks/hyperlink.rb', line 20 def set_sequence(sequence) @sequence = sequence self end |
#target ⇒ Object
29 30 31 |
# File 'lib/docxi/word/hyperlinks/hyperlink.rb', line 29 def target "document.xml" end |