class DocxReport::Hyperlink

Attributes

file[RW]
id[RW]
target[RW]

Public Class Methods

new(target, file, id = nil) click to toggle source
# File lib/docx_report/hyperlink.rb, line 5
def initialize(target, file, id = nil)
  @target = target
  @file = file
  if id.nil?
    generate_id
  else
    @id = id
    file.rels_xml.xpath("//*[@Id='#{id}']").first[:Target] = target
  end
end

Private Instance Methods

generate_id() click to toggle source
# File lib/docx_report/hyperlink.rb, line 18
def generate_id
  @id = "rId#{file.new_uniqe_id}"
  file.rels_xml.children.first << hyperlink_rels
end