Class: Xsv::RelationshipsHandler
- Defined in:
- lib/xsv/relationships_handler.rb
Overview
RelationshipsHandler parses the “xl/_rels/workbook.xml.rels” file to get the existing relationships. This is used internally when opening a workbook.
Constant Summary
Constants inherited from SaxParser
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(&block) ⇒ RelationshipsHandler
constructor
A new instance of RelationshipsHandler.
- #start_element(name, attrs) ⇒ Object
Methods inherited from SaxParser
Constructor Details
#initialize(&block) ⇒ RelationshipsHandler
Returns a new instance of RelationshipsHandler.
15 16 17 |
# File 'lib/xsv/relationships_handler.rb', line 15 def initialize(&block) @block = block end |
Class Method Details
.get_relations(io) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/xsv/relationships_handler.rb', line 7 def self.get_relations(io) relations = [] new { |relation| relations << relation }.parse(io) relations end |
Instance Method Details
#start_element(name, attrs) ⇒ Object
19 20 21 |
# File 'lib/xsv/relationships_handler.rb', line 19 def start_element(name, attrs) @block.call(attrs.slice(:Id, :Type, :Target)) if name == "Relationship" end |