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
-
#to_xml_string(str = '') ⇒ String
seralize the collection of hyperlinks.
Constructor Details
#initialize(worksheet) ⇒ WorksheetHyperlinks
Creates a new Hyperlinks collection
7 8 9 10 11 |
# File 'lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb', line 7 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
16 17 18 19 |
# File 'lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb', line 16 def add() @list << WorksheetHyperlink.new(@worksheet, ) @list.last end |
#relationships ⇒ Object
21 22 23 24 |
# File 'lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb', line 21 def relationships return [] if empty? map { |hyperlink| hyperlink.relationship } end |
#to_xml_string(str = '') ⇒ String
seralize the collection of hyperlinks
28 29 30 31 32 33 |
# File 'lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb', line 28 def to_xml_string(str='') return if empty? str << '<hyperlinks>' @list.each { |hyperlink| hyperlink.to_xml_string(str) } str << '</hyperlinks>' end |