Class: DocXify::Element::WebAddress

Inherits:
Base
  • Object
show all
Defined in:
lib/docxify/element/web_address.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ WebAddress

Returns a new instance of WebAddress.



6
7
8
9
# File 'lib/docxify/element/web_address.rb', line 6

def initialize(target)
  super()
  @target = target
end

Instance Attribute Details

#targetObject

Returns the value of attribute target.



4
5
6
# File 'lib/docxify/element/web_address.rb', line 4

def target
  @target
end

Instance Method Details

#referenceObject



11
12
13
# File 'lib/docxify/element/web_address.rb', line 11

def reference
  "url-#{Digest::SHA1.hexdigest(target)[0, 8]}"
end

#to_sObject



15
16
17
# File 'lib/docxify/element/web_address.rb', line 15

def to_s
  "<Relationship Id=\"#{reference}\" Target=\"#{target}/\" TargetMode=\"External\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink\"/>"
end