class Axlsx::WorksheetHyperlinks

A collection of hyperlink objects for a worksheet

Public Class Methods

new(worksheet) click to toggle source

Creates a new Hyperlinks collection @param [Worksheet] worksheet the worksheet that owns these hyperlinks

Calls superclass method Axlsx::SimpleTypedList::new
# File lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb, line 8
def initialize(worksheet)
  DataTypeValidator.validate "Hyperlinks.worksheet", [Worksheet], worksheet
  @worksheet = worksheet
  super WorksheetHyperlink
end

Public Instance Methods

add(options) click to toggle source

Creates and adds a new hyperlink based on the options provided @see WorksheetHyperlink#initialize @return [WorksheetHyperlink]

# File lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb, line 17
def add(options)
  self << WorksheetHyperlink.new(@worksheet, options)
  last
end
relationships() click to toggle source

The relationships required by this collection’s hyperlinks @return Array

# File lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb, line 24
def relationships
  return [] if empty?
  map { |hyperlink| hyperlink.relationship }
end
to_xml_string(str='') click to toggle source

seralize the collection of hyperlinks @return [String]

# File lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb, line 31
def to_xml_string(str='')
  return if empty?
  str << '<hyperlinks>'
  each { |hyperlink| hyperlink.to_xml_string(str) }
  str << '</hyperlinks>'
end