Class: Axlsx::WorksheetHyperlinks
- Inherits:
-
SimpleTypedList
- Object
- SimpleTypedList
- Axlsx::WorksheetHyperlinks
- Defined in:
- lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb
Overview
A collection of hyperlink objects for a worksheet
Instance Method Summary collapse
-
#add(options) ⇒ WorksheetHyperlink
Creates and adds a new hyperlink based on the options provided.
-
#initialize(worksheet) ⇒ WorksheetHyperlinks
constructor
Creates a new Hyperlinks collection.
-
#relationships ⇒ Object
The relationships required by this collection's hyperlinks.
-
#to_xml_string(str = '') ⇒ String
seralize the collection of hyperlinks.
Constructor Details
#initialize(worksheet) ⇒ WorksheetHyperlinks
Creates a new Hyperlinks collection
8 9 10 11 12 |
# File 'lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb', line 8 def initialize(worksheet) DataTypeValidator.validate "Hyperlinks.worksheet", [Worksheet], worksheet @worksheet = worksheet super WorksheetHyperlink end |
Instance Method Details
#add(options) ⇒ WorksheetHyperlink
Creates and adds a new hyperlink based on the options provided
17 18 19 20 |
# File 'lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb', line 17 def add() self << WorksheetHyperlink.new(@worksheet, ) last end |
#relationships ⇒ Object
The relationships required by this collection's hyperlinks
24 25 26 27 |
# File 'lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb', line 24 def relationships return [] if empty? map { |hyperlink| hyperlink.relationship } end |
#to_xml_string(str = '') ⇒ String
seralize the collection of hyperlinks
31 32 33 34 35 36 |
# 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 |