From 46eadd2724cd841328d90c3143a485fcdf423ed6 Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Fri, 1 Feb 2019 19:22:38 -0500 Subject: New upstream version 2.8.2 --- lib/roo/excelx/relationships.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/roo/excelx/relationships.rb') diff --git a/lib/roo/excelx/relationships.rb b/lib/roo/excelx/relationships.rb index 19f9919..754775d 100644 --- a/lib/roo/excelx/relationships.rb +++ b/lib/roo/excelx/relationships.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'roo/excelx/extractor' module Roo @@ -11,10 +13,16 @@ module Roo @relationships ||= extract_relationships end + def include_type?(type) + to_a.any? do |_, rel| + rel["Type"]&.include? type + end + end + private def extract_relationships - return [] unless doc_exists? + return {} unless doc_exists? doc.xpath('/Relationships/Relationship').each_with_object({}) do |rel, hash| hash[rel['Id']] = rel -- cgit v1.2.3