summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/package.rb
diff options
context:
space:
mode:
authorVladimir Kochnev <[email protected]>2019-03-09 19:49:27 +0300
committerVladimir Kochnev <[email protected]>2019-10-02 18:06:39 +0300
commit09469669ccadf8580643eae8352372e92e1ddbb0 (patch)
tree35514f7979ee3abcbadbb416710c0577b47c924a /lib/axlsx/package.rb
parent913003eaf0456e4645cad91f2622354deae10841 (diff)
downloadcaxlsx-09469669ccadf8580643eae8352372e92e1ddbb0.tar.gz
caxlsx-09469669ccadf8580643eae8352372e92e1ddbb0.zip
Cache relationship in Hash rather than in Array.
Also cacle only ids, not entire instances.
Diffstat (limited to 'lib/axlsx/package.rb')
-rw-r--r--lib/axlsx/package.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb
index 2e9e14fc..56410339 100644
--- a/lib/axlsx/package.rb
+++ b/lib/axlsx/package.rb
@@ -100,13 +100,13 @@ module Axlsx
# File.open('example_streamed.xlsx', 'w') { |f| f.write(s.read) }
def serialize(output, confirm_valid=false)
return false unless !confirm_valid || self.validate.empty?
- Relationship.initialize_cached_instances
+ Relationship.initialize_ids_cache
Zip::OutputStream.open(output) do |zip|
write_parts(zip)
end
true
ensure
- Relationship.clear_cached_instances
+ Relationship.clear_ids_cache
end
@@ -115,13 +115,13 @@ module Axlsx
# @return [StringIO|Boolean] False if confirm_valid and validation errors exist. rewound string IO if not.
def to_stream(confirm_valid=false)
return false unless !confirm_valid || self.validate.empty?
- Relationship.initialize_cached_instances
+ Relationship.initialize_ids_cache
zip = write_parts(Zip::OutputStream.new(StringIO.new, true))
stream = zip.close_buffer
stream.rewind
stream
ensure
- Relationship.clear_cached_instances
+ Relationship.clear_ids_cache
end
# Encrypt the package into a CFB using the password provided